Обсуждение: BUG #15121: Multiple UBSAN errors

Поиск
Список
Период
Сортировка

BUG #15121: Multiple UBSAN errors

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      15121
Logged by:          Martin Liška
Email address:      marxin.liska@gmail.com
PostgreSQL version: 10.3
Operating system:   Linux
Description:

Building current trunk with -fsanitize=undefined I see following errors with
make check:

clog.c:299:3: runtime error: null pointer passed as argument 1, which is
declared to never be null
    #0 0x65c865 in TransactionIdSetPageStatus
/home/marxin/Programming/postgres/src/backend/access/transam/clog.c:299
    #1 0x65c4a5 in TransactionIdSetTreeStatus
/home/marxin/Programming/postgres/src/backend/access/transam/clog.c:190
    #2 0x680830 in TransactionIdCommitTree
/home/marxin/Programming/postgres/src/backend/access/transam/transam.c:262
    #3 0x68d47d in RecordTransactionCommit
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1290
    #4 0x68f1fd in CommitTransaction
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
    #5 0x6908cd in CommitTransactionCommand
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
    #6 0x6e297f in BootstrapModeMain
/home/marxin/Programming/postgres/src/backend/bootstrap/bootstrap.c:515
    #7 0x6e275f in AuxiliaryProcessMain
/home/marxin/Programming/postgres/src/backend/bootstrap/bootstrap.c:434
    #8 0xc1964c in main
/home/marxin/Programming/postgres/src/backend/main/main.c:220
    #9 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #10 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

relcache.c:5932:6: runtime error: null pointer passed as argument 1, which
is declared to never be null
    #0 0x140aa86 in write_item
/home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:5932
    #1 0x140a2e2 in write_relcache_init_file
/home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:5837
    #2 0x13f7a63 in RelationCacheInitializePhase3
/home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:3887
    #3 0x14612a5 in InitPostgres
/home/marxin/Programming/postgres/src/backend/utils/init/postinit.c:997
    #4 0x104661a in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:3777
    #5 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #6 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #7 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

pg_crc32c_sse42.c:37:18: runtime error: load of misaligned address
0x7fffffffd484 for type 'const uint64', which requires 8 byte alignment
0x7fffffffd484: note: pointer points here
  c0 d4 ff ff 01 00 00 00  7f 06 00 00 09 00 00 00  b3 ee bd f7 b3 0a 02 00
cf 10 32 01 00 00 00 80
              ^ 
    #0 0x153f045 in pg_comp_crc32c_sse42
/home/marxin/Programming/postgres/src/port/pg_crc32c_sse42.c:37
    #1 0x6ca43d in XLogRecordAssemble
/home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:780
    #2 0x6c8d6f in XLogInsert
/home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:459
    #3 0x6997bb in XactLogCommitRecord
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:5370
    #4 0x68d3c0 in RecordTransactionCommit
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1225
    #5 0x68f1fd in CommitTransaction
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
    #6 0x6908cd in CommitTransactionCommand
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
    #7 0x104442d in finish_xact_command
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:2498
    #8 0x104052a in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1145
    #9 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #10 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #11 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #12 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

clog.c:299:3: runtime error: null pointer passed as argument 1, which is
declared to never be null
    #0 0x65c865 in TransactionIdSetPageStatus
/home/marxin/Programming/postgres/src/backend/access/transam/clog.c:299
    #1 0x65c4a5 in TransactionIdSetTreeStatus
/home/marxin/Programming/postgres/src/backend/access/transam/clog.c:190
    #2 0x680830 in TransactionIdCommitTree
/home/marxin/Programming/postgres/src/backend/access/transam/transam.c:262
    #3 0x68d47d in RecordTransactionCommit
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1290
    #4 0x68f1fd in CommitTransaction
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
    #5 0x6908cd in CommitTransactionCommand
/home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
    #6 0x104442d in finish_xact_command
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:2498
    #7 0x104052a in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1145
    #8 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #9 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #10 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #11 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

pg_crc32c_sse42.c:44:9: runtime error: load of misaligned address
0x7fffffffcfc2 for type 'const unsigned int', which requires 4 byte
alignment
0x7fffffffcfc2: note: pointer points here
 00 00  c0 8f 07 00 00 08 18 00  01 00 00 02 00 00 00 00  80 fd fe ec ff 7f
00 00  80 d0 6b ed ff 7f
              ^ 
    #0 0x153f111 in pg_comp_crc32c_sse42
/home/marxin/Programming/postgres/src/port/pg_crc32c_sse42.c:44
    #1 0x6ca43d in XLogRecordAssemble
/home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:780
    #2 0x6c8d6f in XLogInsert
/home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:459
    #3 0x58c4bc in heap_insert
/home/marxin/Programming/postgres/src/backend/access/heap/heapam.c:2577
    #4 0xb7ea16 in ExecInsert
/home/marxin/Programming/postgres/src/backend/executor/nodeModifyTable.c:622
    #5 0xb84e26 in ExecModifyTable
/home/marxin/Programming/postgres/src/backend/executor/nodeModifyTable.c:2054
    #6 0xae9bc6 in ExecProcNodeFirst
/home/marxin/Programming/postgres/src/backend/executor/execProcnode.c:446
    #7 0xaccf99 in ExecProcNode
../../../src/include/executor/executor.h:239
    #8 0xad4d36 in ExecutePlan
/home/marxin/Programming/postgres/src/backend/executor/execMain.c:1721
    #9 0xace12c in standard_ExecutorRun
/home/marxin/Programming/postgres/src/backend/executor/execMain.c:361
    #10 0xacdb5c in ExecutorRun
/home/marxin/Programming/postgres/src/backend/executor/execMain.c:304
    #11 0x104831f in ProcessQuery
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:161
    #12 0x104cb11 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1286
    #13 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #14 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #15 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #16 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #17 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #18 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3740:17: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d22b0 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3740
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3740:17: runtime error: member access within misaligned address
0x0000028b937c for type 'union AnyArrayType', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d2329 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3740
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3742:19: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d243b in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3742
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3742:19: runtime error: member access within misaligned address
0x0000028b937c for type 'union AnyArrayType', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d24b5 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3742
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3757:22: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d25f5 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3757
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3757:22: runtime error: member access within misaligned address
0x0000028b937c for type 'union AnyArrayType', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d266e in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3757
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

../../../../src/include/utils/arrayaccess.h:51:6: runtime error: member
access within misaligned address 0x0000028b937c for type 'struct
ExpandedObjectHeader', which requires 8 byte alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10b78e2 in array_iter_setup
../../../../src/include/utils/arrayaccess.h:51
    #1 0x10d2a7c in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3794
    #2 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #3 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #4 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #5 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #6 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #7 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #8 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #9 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #10 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #11 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #12 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #13 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #14 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #15 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #16 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #17 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #18 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #19 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #20 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #21 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #22 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

../../../../src/include/utils/arrayaccess.h:74:17: runtime error: member
access within misaligned address 0x0000028b937c for type 'union
AnyArrayType', which requires 8 byte alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10b8091 in array_iter_setup
../../../../src/include/utils/arrayaccess.h:74
    #1 0x10d2a7c in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3794
    #2 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #3 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #4 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #5 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #6 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #7 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #8 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #9 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #10 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #11 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #12 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #13 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #14 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #15 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #16 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #17 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #18 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #19 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #20 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #21 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #22 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

../../../../src/include/utils/arrayaccess.h:74:17: runtime error: member
access within misaligned address 0x0000028b937c for type 'union
AnyArrayType', which requires 8 byte alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10b80b8 in array_iter_setup
../../../../src/include/utils/arrayaccess.h:74
    #1 0x10d2a7c in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3794
    #2 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #3 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #4 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #5 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #6 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #7 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #8 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #9 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #10 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #11 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #12 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #13 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #14 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #15 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #16 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #17 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #18 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #19 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #20 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #21 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #22 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

../../../../src/include/utils/arrayaccess.h:74:17: runtime error: member
access within misaligned address 0x0000028b937c for type 'union
AnyArrayType', which requires 8 byte alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10b8153 in array_iter_setup
../../../../src/include/utils/arrayaccess.h:74
    #1 0x10d2a7c in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3794
    #2 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #3 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #4 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #5 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #6 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #7 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #8 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #9 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #10 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #11 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #12 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #13 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #14 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #15 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #16 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #17 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #18 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #19 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #20 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #21 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #22 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

../../../../src/include/utils/arrayaccess.h:75:19: runtime error: member
access within misaligned address 0x0000028b937c for type 'union
AnyArrayType', which requires 8 byte alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10b822f in array_iter_setup
../../../../src/include/utils/arrayaccess.h:75
    #1 0x10d2a7c in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3794
    #2 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #3 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #4 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #5 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #6 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #7 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #8 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #9 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #10 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #11 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #12 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #13 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #14 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #15 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #16 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #17 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #18 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #19 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #20 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #21 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #22 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3892:2: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d333a in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3892
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3739:17: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d21eb in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3739
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3739:17: runtime error: member access within misaligned address
0x0000028b937c for type 'union AnyArrayType', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d2264 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3739
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3741:19: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d2375 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3741
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3741:19: runtime error: member access within misaligned address
0x0000028b937c for type 'union AnyArrayType', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d23ef in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3741
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3745:23: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d2529 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3745
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3745:23: runtime error: member access within misaligned address
0x0000028b937c for type 'union AnyArrayType', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d25a2 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3745
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3891:2: runtime error: member access within misaligned address
0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x0000028b937c: note: pointer points here
  6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
01 00 00 00 40 00 00 00
              ^ 
    #0 0x10d32a1 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3891
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x10ed240 in compute_array_stats
/home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
    #8 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #9 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #10 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #11 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #12 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #13 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #14 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #15 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #16 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #17 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #18 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #19 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #21 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3875:24: runtime error: member access within misaligned address
0x00000279c9a4 for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x00000279c9a4: note: pointer points here
  00 01 01 00 70 00 00 00  01 00 00 00 00 00 00 00  15 00 00 00 02 00 00 00
00 00 00 00 01 00 02 00
              ^ 
    #0 0x10d2e2e in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3875
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #8 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #9 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #10 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #11 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #12 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #13 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #14 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #15 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #16 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #17 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #18 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #19 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #20 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3875:24: runtime error: member access within misaligned address
0x00000279c9a4 for type 'union AnyArrayType', which requires 8 byte
alignment
0x00000279c9a4: note: pointer points here
  00 01 01 00 70 00 00 00  01 00 00 00 00 00 00 00  15 00 00 00 02 00 00 00
00 00 00 00 01 00 02 00
              ^ 
    #0 0x10d2eab in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3875
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #8 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #9 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #10 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #11 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #12 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #13 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #14 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #15 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #16 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #17 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #18 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #19 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #20 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3875:24: runtime error: member access within misaligned address
0x00000279c9a4 for type 'union AnyArrayType', which requires 8 byte
alignment
0x00000279c9a4: note: pointer points here
  00 01 01 00 70 00 00 00  01 00 00 00 00 00 00 00  15 00 00 00 02 00 00 00
00 00 00 00 01 00 02 00
              ^ 
    #0 0x10d2ed2 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3875
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #8 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #9 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #10 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #11 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #12 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #13 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #14 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #15 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #16 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #17 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #18 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #19 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #20 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3876:24: runtime error: member access within misaligned address
0x00000279cab4 for type 'struct ExpandedObjectHeader', which requires 8 byte
alignment
0x00000279cab4: note: pointer points here
  00 01 01 00 70 00 00 00  01 00 00 00 00 00 00 00  15 00 00 00 02 00 00 00
00 00 00 00 01 00 02 00
              ^ 
    #0 0x10d2f65 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3876
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #8 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #9 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #10 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #11 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #12 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #13 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #14 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #15 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #16 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #17 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #18 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #19 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #20 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3876:24: runtime error: member access within misaligned address
0x00000279cab4 for type 'union AnyArrayType', which requires 8 byte
alignment
0x00000279cab4: note: pointer points here
  00 01 01 00 70 00 00 00  01 00 00 00 00 00 00 00  15 00 00 00 02 00 00 00
00 00 00 00 01 00 02 00
              ^ 
    #0 0x10d2fe2 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3876
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #8 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #9 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #10 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #11 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #12 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #13 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #14 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #15 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #16 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #17 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #18 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #19 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #20 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

arrayfuncs.c:3876:24: runtime error: member access within misaligned address
0x00000279cab4 for type 'union AnyArrayType', which requires 8 byte
alignment
0x00000279cab4: note: pointer points here
  00 01 01 00 70 00 00 00  01 00 00 00 00 00 00 00  15 00 00 00 02 00 00 00
00 00 00 00 01 00 02 00
              ^ 
    #0 0x10d3009 in array_cmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3876
    #1 0x10d208a in btarraycmp
/home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
    #2 0x14d7fd8 in comparison_shim
/home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
    #3 0x8f6bcb in ApplySortComparator
../../../src/include/utils/sortsupport.h:225
    #4 0x9079c7 in compare_scalars
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
    #5 0x153d1e6 in qsort_arg
/home/marxin/Programming/postgres/src/port/qsort_arg.c:140
    #6 0x904cfa in compute_scalar_stats
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
    #7 0x8f990f in do_analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
    #8 0x8f7c9f in analyze_rel
/home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
    #9 0xa7e1bb in vacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
    #10 0xa7d925 in ExecVacuum
/home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
    #11 0x104f38e in standard_ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
    #12 0x104e364 in ProcessUtility
/home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
    #13 0x104c6d2 in PortalRunUtility
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
    #14 0x104cca6 in PortalRunMulti
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
    #15 0x104afc0 in PortalRun
/home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
    #16 0x1040463 in exec_simple_query
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
    #17 0x1046bf1 in PostgresMain
/home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
    #18 0xc19777 in main
/home/marxin/Programming/postgres/src/backend/main/main.c:224
    #19 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #20 0x4863d9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)

print.c:916:4: runtime error: null pointer passed as argument 1, which is
declared to never be null
    #0 0x4904da in print_aligned_text
/home/marxin/Programming/postgres/src/fe_utils/print.c:916
    #1 0x4a0ca2 in printTable
/home/marxin/Programming/postgres/src/fe_utils/print.c:3235
    #2 0x4a171f in printQuery
/home/marxin/Programming/postgres/src/fe_utils/print.c:3347
    #3 0x414286 in PrintQueryTuples
/home/marxin/Programming/postgres/src/bin/psql/common.c:890
    #4 0x414d6f in PrintQueryResults
/home/marxin/Programming/postgres/src/bin/psql/common.c:1224
    #5 0x41559d in SendQuery
/home/marxin/Programming/postgres/src/bin/psql/common.c:1408
    #6 0x4356c6 in MainLoop
/home/marxin/Programming/postgres/src/bin/psql/mainloop.c:431
    #7 0x40d248 in process_file
/home/marxin/Programming/postgres/src/bin/psql/command.c:3563
    #8 0x44c8f8 in main
/home/marxin/Programming/postgres/src/bin/psql/startup.c:375
    #9 0x7ffff5feca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #10 0x4048f9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/psql+0x4048f9)

print.c:916:4: runtime error: null pointer passed as argument 1, which is
declared to never be null
    #0 0x4904da in print_aligned_text
/home/marxin/Programming/postgres/src/fe_utils/print.c:916
    #1 0x4a0ca2 in printTable
/home/marxin/Programming/postgres/src/fe_utils/print.c:3235
    #2 0x4a171f in printQuery
/home/marxin/Programming/postgres/src/fe_utils/print.c:3347
    #3 0x414286 in PrintQueryTuples
/home/marxin/Programming/postgres/src/bin/psql/common.c:890
    #4 0x414d6f in PrintQueryResults
/home/marxin/Programming/postgres/src/bin/psql/common.c:1224
    #5 0x41559d in SendQuery
/home/marxin/Programming/postgres/src/bin/psql/common.c:1408
    #6 0x4356c6 in MainLoop
/home/marxin/Programming/postgres/src/bin/psql/mainloop.c:431
    #7 0x40d248 in process_file
/home/marxin/Programming/postgres/src/bin/psql/command.c:3563
    #8 0x44c8f8 in main
/home/marxin/Programming/postgres/src/bin/psql/startup.c:375
    #9 0x7ffff5feca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #10 0x4048f9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/psql+0x4048f9)

print.c:916:4: runtime error: null pointer passed as argument 1, which is
declared to never be null
    #0 0x4904da in print_aligned_text
/home/marxin/Programming/postgres/src/fe_utils/print.c:916
    #1 0x4a0ca2 in printTable
/home/marxin/Programming/postgres/src/fe_utils/print.c:3235
    #2 0x4a171f in printQuery
/home/marxin/Programming/postgres/src/fe_utils/print.c:3347
    #3 0x414286 in PrintQueryTuples
/home/marxin/Programming/postgres/src/bin/psql/common.c:890
    #4 0x414d6f in PrintQueryResults
/home/marxin/Programming/postgres/src/bin/psql/common.c:1224
    #5 0x41559d in SendQuery
/home/marxin/Programming/postgres/src/bin/psql/common.c:1408
    #6 0x4356c6 in MainLoop
/home/marxin/Programming/postgres/src/bin/psql/mainloop.c:431
    #7 0x40d248 in process_file
/home/marxin/Programming/postgres/src/bin/psql/command.c:3563
    #8 0x44c8f8 in main
/home/marxin/Programming/postgres/src/bin/psql/startup.c:375
    #9 0x7ffff5feca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
    #10 0x4048f9 in _start
(/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/psql+0x4048f9)




Re: BUG #15121: Multiple UBSAN errors

От
Tomas Vondra
Дата:
On 03/18/2018 08:59 PM, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      15121
> Logged by:          Martin Liška
> Email address:      marxin.liska@gmail.com
> PostgreSQL version: 10.3
> Operating system:   Linux
> Description:        
> 
> Building current trunk with -fsanitize=undefined I see following errors with
> make check:
> 
> clog.c:299:3: runtime error: null pointer passed as argument 1, which is
> declared to never be null
>     #0 0x65c865 in TransactionIdSetPageStatus
> /home/marxin/Programming/postgres/src/backend/access/transam/clog.c:299
>     #1 0x65c4a5 in TransactionIdSetTreeStatus
> /home/marxin/Programming/postgres/src/backend/access/transam/clog.c:190
>     #2 0x680830 in TransactionIdCommitTree
> /home/marxin/Programming/postgres/src/backend/access/transam/transam.c:262
>     #3 0x68d47d in RecordTransactionCommit
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1290
>     #4 0x68f1fd in CommitTransaction
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
>     #5 0x6908cd in CommitTransactionCommand
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
>     #6 0x6e297f in BootstrapModeMain
> /home/marxin/Programming/postgres/src/backend/bootstrap/bootstrap.c:515
>     #7 0x6e275f in AuxiliaryProcessMain
> /home/marxin/Programming/postgres/src/backend/bootstrap/bootstrap.c:434
>     #8 0xc1964c in main
> /home/marxin/Programming/postgres/src/backend/main/main.c:220
>     #9 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>     #10 0x4863d9 in _start
> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
> 

Not sure what this is - the lines don't seem to match to the sources, so
presumably it's shifted somehow. So hard to say which pointer is it
complaining about ...

> relcache.c:5932:6: runtime error: null pointer passed as argument 1, which
> is declared to never be null
>     #0 0x140aa86 in write_item
> /home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:5932
>     #1 0x140a2e2 in write_relcache_init_file
> /home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:5837
>     #2 0x13f7a63 in RelationCacheInitializePhase3
> /home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:3887
>     #3 0x14612a5 in InitPostgres
> /home/marxin/Programming/postgres/src/backend/utils/init/postinit.c:997
>     #4 0x104661a in PostgresMain
> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:3777
>     #5 0xc19777 in main
> /home/marxin/Programming/postgres/src/backend/main/main.c:224
>     #6 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>     #7 0x4863d9 in _start
> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
> 

This is apparently because we call write_item() like this:

    /* next, do the access method specific field */
    write_item(rel->rd_options,
               (rel->rd_options ? VARSIZE(rel->rd_options) : 0),
               fp);

and it then does this:

    static void
    write_item(const void *data, Size len, FILE *fp)
    {
        if (fwrite(&len, 1, sizeof(len), fp) != sizeof(len))
            elog(FATAL, "could not write init file");
        if (fwrite(data, 1, len, fp) != len)
            elog(FATAL, "could not write init file");
    }

So the second fwrite call may do "fwrite(NULL,1,0,fp)" i.e. it writes 0
bytes from NULL pointer. Which I guess should work fine, because it does
not need to access the pointer at all.

I don't know where does the "declared to never be null" comes from.

> pg_crc32c_sse42.c:37:18: runtime error: load of misaligned address
> 0x7fffffffd484 for type 'const uint64', which requires 8 byte alignment
> 0x7fffffffd484: note: pointer points here
>   c0 d4 ff ff 01 00 00 00  7f 06 00 00 09 00 00 00  b3 ee bd f7 b3 0a 02 00 
> cf 10 32 01 00 00 00 80
>               ^ 
>     #0 0x153f045 in pg_comp_crc32c_sse42
> /home/marxin/Programming/postgres/src/port/pg_crc32c_sse42.c:37
>     #1 0x6ca43d in XLogRecordAssemble
> /home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:780
>     #2 0x6c8d6f in XLogInsert
> /home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:459
>     #3 0x6997bb in XactLogCommitRecord
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:5370
>     #4 0x68d3c0 in RecordTransactionCommit
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1225
>     #5 0x68f1fd in CommitTransaction
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
>     #6 0x6908cd in CommitTransactionCommand
> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
>     #7 0x104442d in finish_xact_command
> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:2498
>     #8 0x104052a in exec_simple_query
> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1145
>     #9 0x1046bf1 in PostgresMain
> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
>     #10 0xc19777 in main
> /home/marxin/Programming/postgres/src/backend/main/main.c:224
>     #11 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>     #12 0x4863d9 in _start
> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
> 

This comes from this call in pg_comp_crc32c_sse42

    crc = (uint32) _mm_crc32_u64(crc, *((const uint64 *) p));

and it's explained in the comment right above it:

/*
 * Process eight bytes of data at a time.
 *
 * NB: We do unaligned accesses here. The Intel architecture allows
 * that, and performance testing didn't show any performance gain
 * from aligning the begin address.
 */

So, not a bug.

> 
> arrayfuncs.c:3740:17: runtime error: member access within misaligned address
> 0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
> alignment
> 0x0000028b937c: note: pointer points here
>   6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00 
> 01 00 00 00 40 00 00 00
>               ^ 
>     #0 0x10d22b0 in array_cmp
> /home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3740
>     #1 0x10d208a in btarraycmp
> /home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
>     #2 0x14d7fd8 in comparison_shim
> /home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
>     #3 0x8f6bcb in ApplySortComparator
> ../../../src/include/utils/sortsupport.h:225
>     #4 0x9079c7 in compare_scalars
> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
>     #5 0x153d1e6 in qsort_arg
> /home/marxin/Programming/postgres/src/port/qsort_arg.c:140
>     #6 0x904cfa in compute_scalar_stats
> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
>     #7 0x10ed240 in compute_array_stats
> /home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
>     #8 0x8f990f in do_analyze_rel
> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
>     #9 0x8f7c9f in analyze_rel
> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
>     #10 0xa7e1bb in vacuum
> /home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
>     #11 0xa7d925 in ExecVacuum
> /home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
>     #12 0x104f38e in standard_ProcessUtility
> /home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
>     #13 0x104e364 in ProcessUtility
> /home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
>     #14 0x104c6d2 in PortalRunUtility
> /home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
>     #15 0x104cca6 in PortalRunMulti
> /home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
>     #16 0x104afc0 in PortalRun
> /home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
>     #17 0x1040463 in exec_simple_query
> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
>     #18 0x1046bf1 in PostgresMain
> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
>     #19 0xc19777 in main
> /home/marxin/Programming/postgres/src/backend/main/main.c:224
>     #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>     #21 0x4863d9 in _start
> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
> 


Again, the line numbers don't really match the code I have, but I guess
it's the same issue as for pg_comp_crc32c_sse42. This is apparently
related to array serialization, and I guess we have a compact structure
(intentionally, to make it smaller), and we accept the unaligned access.

> print.c:916:4: runtime error: null pointer passed as argument 1, which is
> declared to never be null
>     #0 0x4904da in print_aligned_text
> /home/marxin/Programming/postgres/src/fe_utils/print.c:916
>     #1 0x4a0ca2 in printTable
> /home/marxin/Programming/postgres/src/fe_utils/print.c:3235
>     #2 0x4a171f in printQuery
> /home/marxin/Programming/postgres/src/fe_utils/print.c:3347
>     #3 0x414286 in PrintQueryTuples
> /home/marxin/Programming/postgres/src/bin/psql/common.c:890
>     #4 0x414d6f in PrintQueryResults
> /home/marxin/Programming/postgres/src/bin/psql/common.c:1224
>     #5 0x41559d in SendQuery
> /home/marxin/Programming/postgres/src/bin/psql/common.c:1408
>     #6 0x4356c6 in MainLoop
> /home/marxin/Programming/postgres/src/bin/psql/mainloop.c:431
>     #7 0x40d248 in process_file
> /home/marxin/Programming/postgres/src/bin/psql/command.c:3563
>     #8 0x44c8f8 in main
> /home/marxin/Programming/postgres/src/bin/psql/startup.c:375
>     #9 0x7ffff5feca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>     #10 0x4048f9 in _start
> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/psql+0x4048f9)
> 

No idea, line numbers shifted again. My guess would be something like
the fwrite() report, but this time with fputs(). Not sure which of the
calls, though.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
On 19 March 2018 at 01:34, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
> On 03/18/2018 08:59 PM, PG Bug reporting form wrote:
>> The following bug has been logged on the website:
>>
>> Bug reference:      15121
>> Logged by:          Martin Liška
>> Email address:      marxin.liska@gmail.com
>> PostgreSQL version: 10.3
>> Operating system:   Linux
>> Description:
>>
>> Building current trunk with -fsanitize=undefined I see following errors with
>> make check:
>>
>> clog.c:299:3: runtime error: null pointer passed as argument 1, which is
>> declared to never be null
>>     #0 0x65c865 in TransactionIdSetPageStatus
>> /home/marxin/Programming/postgres/src/backend/access/transam/clog.c:299
>>     #1 0x65c4a5 in TransactionIdSetTreeStatus
>> /home/marxin/Programming/postgres/src/backend/access/transam/clog.c:190
>>     #2 0x680830 in TransactionIdCommitTree
>> /home/marxin/Programming/postgres/src/backend/access/transam/transam.c:262
>>     #3 0x68d47d in RecordTransactionCommit
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1290
>>     #4 0x68f1fd in CommitTransaction
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
>>     #5 0x6908cd in CommitTransactionCommand
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
>>     #6 0x6e297f in BootstrapModeMain
>> /home/marxin/Programming/postgres/src/backend/bootstrap/bootstrap.c:515
>>     #7 0x6e275f in AuxiliaryProcessMain
>> /home/marxin/Programming/postgres/src/backend/bootstrap/bootstrap.c:434
>>     #8 0xc1964c in main
>> /home/marxin/Programming/postgres/src/backend/main/main.c:220
>>     #9 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>>     #10 0x4863d9 in _start
>> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
>>
>
> Not sure what this is - the lines don't seem to match to the sources, so
> presumably it's shifted somehow. So hard to say which pointer is it
> complaining about ...

I build current git master:

commit a4678320471380e5159a8d6e89466d74d6ee1739 (HEAD, origin/master,
origin/HEAD)
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Sun Mar 18 15:10:28 2018 -0400

    Doc: note that statement-level view triggers require an INSTEAD OF trigger.

    If a view lacks an INSTEAD OF trigger, DML on it can only work by rewriting
    the command into a command on the underlying base table(s).  Then we will
    fire triggers attached to those table(s), not those for the view.  This
    seems appropriate from a consistency standpoint, but nowhere was the
    behavior explicitly documented, so let's do that.

    There was some discussion of throwing an error or warning if a statement
    trigger is created on a view without creating a row INSTEAD OF trigger.
    But a simple implementation of that would result in dump/restore ordering
    hazards.  Given that it's been like this all along, and we hadn't heard
    a complaint till now, a documentation improvement seems sufficient.

    Per bug #15106 from Pu Qun.  Back-patch to all supported branches.

    Discussion:
https://postgr.es/m/152083391168.1215.16892140713507052796@wrigleys.postgresql.org

Note that I use following git repository:
git remote -v
origin https://github.com/postgres/postgres.git (fetch)

The memcmp is defined in /usr/include/string.h with:
extern int memcmp (const void *__s1, const void *__s2, size_t __n)
     __attribute__ ((__nothrow__ , __leaf__)) __attribute__
((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

>
>> relcache.c:5932:6: runtime error: null pointer passed as argument 1, which
>> is declared to never be null
>>     #0 0x140aa86 in write_item
>> /home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:5932
>>     #1 0x140a2e2 in write_relcache_init_file
>> /home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:5837
>>     #2 0x13f7a63 in RelationCacheInitializePhase3
>> /home/marxin/Programming/postgres/src/backend/utils/cache/relcache.c:3887
>>     #3 0x14612a5 in InitPostgres
>> /home/marxin/Programming/postgres/src/backend/utils/init/postinit.c:997
>>     #4 0x104661a in PostgresMain
>> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:3777
>>     #5 0xc19777 in main
>> /home/marxin/Programming/postgres/src/backend/main/main.c:224
>>     #6 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>>     #7 0x4863d9 in _start
>> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
>>
>
> This is apparently because we call write_item() like this:
>
>     /* next, do the access method specific field */
>     write_item(rel->rd_options,
>                (rel->rd_options ? VARSIZE(rel->rd_options) : 0),
>                fp);
>
> and it then does this:
>
>     static void
>     write_item(const void *data, Size len, FILE *fp)
>     {
>         if (fwrite(&len, 1, sizeof(len), fp) != sizeof(len))
>             elog(FATAL, "could not write init file");
>         if (fwrite(data, 1, len, fp) != len)
>             elog(FATAL, "could not write init file");
>     }
>
> So the second fwrite call may do "fwrite(NULL,1,0,fp)" i.e. it writes 0
> bytes from NULL pointer. Which I guess should work fine, because it does
> not need to access the pointer at all.
>
> I don't know where does the "declared to never be null" comes from.

It's GCC internal builtin that is used. Maybe we can make it more
smart to not print and
error if size == 0. On the other hand compiler can do optimizations
based on nonnull argument
thus I would recommend to do if(size != 0) fwrite..

>
>> pg_crc32c_sse42.c:37:18: runtime error: load of misaligned address
>> 0x7fffffffd484 for type 'const uint64', which requires 8 byte alignment
>> 0x7fffffffd484: note: pointer points here
>>   c0 d4 ff ff 01 00 00 00  7f 06 00 00 09 00 00 00  b3 ee bd f7 b3 0a 02 00
>> cf 10 32 01 00 00 00 80
>>               ^
>>     #0 0x153f045 in pg_comp_crc32c_sse42
>> /home/marxin/Programming/postgres/src/port/pg_crc32c_sse42.c:37
>>     #1 0x6ca43d in XLogRecordAssemble
>> /home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:780
>>     #2 0x6c8d6f in XLogInsert
>> /home/marxin/Programming/postgres/src/backend/access/transam/xloginsert.c:459
>>     #3 0x6997bb in XactLogCommitRecord
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:5370
>>     #4 0x68d3c0 in RecordTransactionCommit
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:1225
>>     #5 0x68f1fd in CommitTransaction
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2037
>>     #6 0x6908cd in CommitTransactionCommand
>> /home/marxin/Programming/postgres/src/backend/access/transam/xact.c:2768
>>     #7 0x104442d in finish_xact_command
>> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:2498
>>     #8 0x104052a in exec_simple_query
>> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1145
>>     #9 0x1046bf1 in PostgresMain
>> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
>>     #10 0xc19777 in main
>> /home/marxin/Programming/postgres/src/backend/main/main.c:224
>>     #11 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>>     #12 0x4863d9 in _start
>> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
>>
>
> This comes from this call in pg_comp_crc32c_sse42
>
>     crc = (uint32) _mm_crc32_u64(crc, *((const uint64 *) p));
>
> and it's explained in the comment right above it:
>
> /*
>  * Process eight bytes of data at a time.
>  *
>  * NB: We do unaligned accesses here. The Intel architecture allows
>  * that, and performance testing didn't show any performance gain
>  * from aligning the begin address.
>  */
>
> So, not a bug.

Agree with that!

>
>>
>> arrayfuncs.c:3740:17: runtime error: member access within misaligned address
>> 0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
>> alignment
>> 0x0000028b937c: note: pointer points here
>>   6f 6f 00 00 80 02 00 00  01 00 00 00 00 00 00 00  19 00 00 00 08 00 00 00
>> 01 00 00 00 40 00 00 00
>>               ^
>>     #0 0x10d22b0 in array_cmp
>> /home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3740
>>     #1 0x10d208a in btarraycmp
>> /home/marxin/Programming/postgres/src/backend/utils/adt/arrayfuncs.c:3724
>>     #2 0x14d7fd8 in comparison_shim
>> /home/marxin/Programming/postgres/src/backend/utils/sort/sortsupport.c:53
>>     #3 0x8f6bcb in ApplySortComparator
>> ../../../src/include/utils/sortsupport.h:225
>>     #4 0x9079c7 in compare_scalars
>> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:2855
>>     #5 0x153d1e6 in qsort_arg
>> /home/marxin/Programming/postgres/src/port/qsort_arg.c:140
>>     #6 0x904cfa in compute_scalar_stats
>> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:2412
>>     #7 0x10ed240 in compute_array_stats
>> /home/marxin/Programming/postgres/src/backend/utils/adt/array_typanalyze.c:250
>>     #8 0x8f990f in do_analyze_rel
>> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:579
>>     #9 0x8f7c9f in analyze_rel
>> /home/marxin/Programming/postgres/src/backend/commands/analyze.c:310
>>     #10 0xa7e1bb in vacuum
>> /home/marxin/Programming/postgres/src/backend/commands/vacuum.c:357
>>     #11 0xa7d925 in ExecVacuum
>> /home/marxin/Programming/postgres/src/backend/commands/vacuum.c:141
>>     #12 0x104f38e in standard_ProcessUtility
>> /home/marxin/Programming/postgres/src/backend/tcop/utility.c:667
>>     #13 0x104e364 in ProcessUtility
>> /home/marxin/Programming/postgres/src/backend/tcop/utility.c:358
>>     #14 0x104c6d2 in PortalRunUtility
>> /home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1178
>>     #15 0x104cca6 in PortalRunMulti
>> /home/marxin/Programming/postgres/src/backend/tcop/pquery.c:1324
>>     #16 0x104afc0 in PortalRun
>> /home/marxin/Programming/postgres/src/backend/tcop/pquery.c:799
>>     #17 0x1040463 in exec_simple_query
>> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:1120
>>     #18 0x1046bf1 in PostgresMain
>> /home/marxin/Programming/postgres/src/backend/tcop/postgres.c:4144
>>     #19 0xc19777 in main
>> /home/marxin/Programming/postgres/src/backend/main/main.c:224
>>     #20 0x7ffff635ca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>>     #21 0x4863d9 in _start
>> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/postgres+0x4863d9)
>>
>
>
> Again, the line numbers don't really match the code I have, but I guess
> it's the same issue as for pg_comp_crc32c_sse42. This is apparently
> related to array serialization, and I guess we have a compact structure
> (intentionally, to make it smaller), and we accept the unaligned access.

Note that building postgresql with -03, I see some array tests failing.

>
>> print.c:916:4: runtime error: null pointer passed as argument 1, which is
>> declared to never be null
>>     #0 0x4904da in print_aligned_text
>> /home/marxin/Programming/postgres/src/fe_utils/print.c:916
>>     #1 0x4a0ca2 in printTable
>> /home/marxin/Programming/postgres/src/fe_utils/print.c:3235
>>     #2 0x4a171f in printQuery
>> /home/marxin/Programming/postgres/src/fe_utils/print.c:3347
>>     #3 0x414286 in PrintQueryTuples
>> /home/marxin/Programming/postgres/src/bin/psql/common.c:890
>>     #4 0x414d6f in PrintQueryResults
>> /home/marxin/Programming/postgres/src/bin/psql/common.c:1224
>>     #5 0x41559d in SendQuery
>> /home/marxin/Programming/postgres/src/bin/psql/common.c:1408
>>     #6 0x4356c6 in MainLoop
>> /home/marxin/Programming/postgres/src/bin/psql/mainloop.c:431
>>     #7 0x40d248 in process_file
>> /home/marxin/Programming/postgres/src/bin/psql/command.c:3563
>>     #8 0x44c8f8 in main
>> /home/marxin/Programming/postgres/src/bin/psql/startup.c:375
>>     #9 0x7ffff5feca86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
>>     #10 0x4048f9 in _start
>> (/home/marxin/Programming/postgres/tmp_install/usr/local/pgsql/bin/psql+0x4048f9)
>>
>
> No idea, line numbers shifted again. My guess would be something like
> the fwrite() report, but this time with fputs(). Not sure which of the
> calls, though.

This one is a memset.

Hope you'll be able to locate error in source files.

Martin

>
> regards
>
> --
> Tomas Vondra                  http://www.2ndQuadrant.com
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
On 19 March 2018 at 02:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>> On 03/18/2018 08:59 PM, PG Bug reporting form wrote:
>>> Building current trunk with -fsanitize=undefined I see following errors with
>>> make check:
>
>>> pg_crc32c_sse42.c:37:18: runtime error: load of misaligned address
>>> 0x7fffffffd484 for type 'const uint64', which requires 8 byte alignment
>>> 0x7fffffffd484: note: pointer points here
>
>> This comes from this call in pg_comp_crc32c_sse42
>>     crc = (uint32) _mm_crc32_u64(crc, *((const uint64 *) p));
>> ...
>> So, not a bug.
>
> Agreed.  That's Intel-only code so it doesn't need to be strict
> about alignment.
>
>>> arrayfuncs.c:3740:17: runtime error: member access within misaligned address
>>> 0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
>>> alignment
>
>> Again, the line numbers don't really match the code I have, but I guess
>> it's the same issue as for pg_comp_crc32c_sse42. This is apparently
>> related to array serialization, and I guess we have a compact structure
>> (intentionally, to make it smaller), and we accept the unaligned access.
>
> No, there's no intentional misalignment in the array stuff; if there
> were, it'd fail on alignment-picky hardware.
>
> What I think might be happening is that the compiler is taking the
> fact that the pointer is declared as AnyArrayType *, where
>
> typedef union AnyArrayType
> {
>         ArrayType       flt;
>         ExpandedArrayHeader xpn;
> } AnyArrayType;

Hi.

>
> to assume that the pointer must be aligned on an 8-byte boundary because
> ExpandedArrayHeader would require that, even if we're only accessing the
> "flt" member.  Maybe that's a live problem, though we've seen no related
> trouble reports.  It'd require the compiler to generate 8-byte-aligned
> instructions for accessing the ArrayType header, which doesn't seem all
> that probable.

Yes, it's this:
https://stackoverflow.com/questions/891471/union-element-alignment/891473#891473

Thanks,
Martin

>
>                         regards, tom lane


Re: BUG #15121: Multiple UBSAN errors

От
Tomas Vondra
Дата:
On 03/19/2018 09:59 AM, Martin Liška wrote:
> On 19 March 2018 at 01:34, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>
> ...
>>
>> Again, the line numbers don't really match the code I have, but I guess
>> it's the same issue as for pg_comp_crc32c_sse42. This is apparently
>> related to array serialization, and I guess we have a compact structure
>> (intentionally, to make it smaller), and we accept the unaligned access.
> 
> Note that building postgresql with -03, I see some array tests failing.
> 

I'm unable to reproduce that. I do get a bunch of compile-time warnings
about possibly uninitialized variables (which seem bogus after a quick
inspection), but no failures.

Which gcc version are you using? Mine is 6.4.1. Do the failures happen
every time or rarely?

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
On 19 March 2018 at 15:26, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
> On 03/19/2018 09:59 AM, Martin Liška wrote:
>> On 19 March 2018 at 01:34, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>>
>> ...
>>>
>>> Again, the line numbers don't really match the code I have, but I guess
>>> it's the same issue as for pg_comp_crc32c_sse42. This is apparently
>>> related to array serialization, and I guess we have a compact structure
>>> (intentionally, to make it smaller), and we accept the unaligned access.
>>
>> Note that building postgresql with -03, I see some array tests failing.
>>
>
> I'm unable to reproduce that. I do get a bunch of compile-time warnings
> about possibly uninitialized variables (which seem bogus after a quick
> inspection), but no failures.

Note that the errrors I reported come from running an instrumented postgres
with "-fsanitize=undefined -g" option.

>
> Which gcc version are you using? Mine is 6.4.1. Do the failures happen
> every time or rarely?

Every time with current GCC trunk:

./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-pc-linux-gnu
Configured with: ../configure --enable-languages=c,c++,fortran
--disable-bootstrap --prefix=/home/marxin/bin/gcc : (reconfigured)
../configure --enable-languages=c,c++,fortran --disable-bootstrap
--prefix=/home/marxin/bin/gcc
Thread model: posix
gcc version 8.0.1 20180319 (experimental) (GCC)

But using latest release GCC 7.3.0 should provide similar _runtime_ errors.

Martin

>
> regards
>
> --
> Tomas Vondra                  http://www.2ndQuadrant.com
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Tomas Vondra
Дата:

On 03/19/2018 03:28 PM, Martin Liška wrote:
> On 19 March 2018 at 15:26, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>> On 03/19/2018 09:59 AM, Martin Liška wrote:
>>> On 19 March 2018 at 01:34, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>>>
>>> ...
>>>>
>>>> Again, the line numbers don't really match the code I have, but I guess
>>>> it's the same issue as for pg_comp_crc32c_sse42. This is apparently
>>>> related to array serialization, and I guess we have a compact structure
>>>> (intentionally, to make it smaller), and we accept the unaligned access.
>>>
>>> Note that building postgresql with -03, I see some array tests failing.
>>>
>>
>> I'm unable to reproduce that. I do get a bunch of compile-time warnings
>> about possibly uninitialized variables (which seem bogus after a quick
>> inspection), but no failures.
> 
> Note that the errrors I reported come from running an instrumented postgres
> with "-fsanitize=undefined -g" option.
> 

I'm getting failures in errors, union and alter_table, but none of those
are related to arrays. So, which tests are failing for you and how do
the failures look like?

I've tried both gcc 7.3 and trunk, and all failures look like this:

-- this used to be a syntax error, but now we allow an empty target list
select;
+ print.c:916:4: runtime error: null pointer passed as argument 1, which
is declared to never be null
+ /usr/include/bits/string3.h:90:10: runtime error: null pointer passed
as argument 1, which is declared to never be null

Which seems to trigger the error on this line in print.c:

    memset(header_done, false, col_count * sizeof(bool));

likely because with empty select list col_count=0. So about the same
cause as for fwrite().


-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Tom Lane
Дата:
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> On 03/19/2018 03:28 PM, Martin Liška wrote:
>>>> Note that building postgresql with -03, I see some array tests failing.

> I'm getting failures in errors, union and alter_table, but none of those
> are related to arrays. So, which tests are failing for you and how do
> the failures look like?

I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
and indeed that's got some problems.  It looks like array_out fails
for multidimensional arrays, because all the diffs look about
like this one:

*** 106,116 ****
    SET c[2:2] = '{"new_word"}'
                  
    WHERE array_dims(c) is not null;
                  
  SELECT a,b,c FROM arrtest;
                  
!        a       |           b           |         c
                  
! ---------------+-----------------------+-------------------
                  
!  {16,25,3,4,5} | {{{113,142},{1,147}}} | {}
                  
!  {}            | {3,4}                 | {foo,new_word}
                  
!  {16,25,23}    | {{3,4},{4,5}}         | {foobar,new_word}
                  
  (3 rows)
                  

                  
  SELECT a[1:3],
                  
--- 106,116 ----
    SET c[2:2] = '{"new_word"}'
                  
    WHERE array_dims(c) is not null;
                  
  SELECT a,b,c FROM arrtest;
                  
!        a       |       b       |         c
                  
! ---------------+---------------+-------------------
                  
!  {16,25,3,4,5} | {{            | {}
                  
!  {}            | {3,4}         | {foo,new_word}
                  
!  {16,25,23}    | {{3,4},{4,5}} | {foobar,new_word}
                  
  (3 rows)
                  

                  
  SELECT a[1:3],
                  

Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
that print wrong.  Very odd.  Maybe it's bad code on our part,
but I think the odds are at least as good that it's a new gcc bug.

            regards, tom lane


Re: BUG #15121: Multiple UBSAN errors

От
Andres Freund
Дата:
On 2018-03-19 14:20:33 -0400, Tom Lane wrote:
> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
> and indeed that's got some problems.

> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
> that print wrong.  Very odd.  Maybe it's bad code on our part,
> but I think the odds are at least as good that it's a new gcc bug.

Might be worth trying with a new clang, I think it's been a bit ahead on
the quality of the ubsan (et al) integration quality.

Greetings,

Andres Freund


Re: BUG #15121: Multiple UBSAN errors

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> On 2018-03-19 14:20:33 -0400, Tom Lane wrote:
>> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
>> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
>> and indeed that's got some problems.

>> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
>> that print wrong.  Very odd.  Maybe it's bad code on our part,
>> but I think the odds are at least as good that it's a new gcc bug.

> Might be worth trying with a new clang, I think it's been a bit ahead on
> the quality of the ubsan (et al) integration quality.

I'm not talking about ubsan, I'm just talking about whether our regression
tests pass with the higher -O level.

            regards, tom lane


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
On 19 March 2018 at 19:20, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>> On 03/19/2018 03:28 PM, Martin Liška wrote:
>>>>> Note that building postgresql with -03, I see some array tests failing.
>
>> I'm getting failures in errors, union and alter_table, but none of those
>> are related to arrays. So, which tests are failing for you and how do
>> the failures look like?
>
> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
> and indeed that's got some problems.  It looks like array_out fails
> for multidimensional arrays, because all the diffs look about
> like this one:

I can confirm it's really caused by -O3 optimization level for the function:
array_out

If you give me couple of minutes, I will isolate why is that caused.

>
> *** 106,116 ****
>     SET c[2:2] = '{"new_word"}'
>     WHERE array_dims(c) is not null;
>   SELECT a,b,c FROM arrtest;
> !        a       |           b           |         c
> ! ---------------+-----------------------+-------------------
> !  {16,25,3,4,5} | {{{113,142},{1,147}}} | {}
> !  {}            | {3,4}                 | {foo,new_word}
> !  {16,25,23}    | {{3,4},{4,5}}         | {foobar,new_word}
>   (3 rows)
>
>   SELECT a[1:3],
> --- 106,116 ----
>     SET c[2:2] = '{"new_word"}'
>     WHERE array_dims(c) is not null;
>   SELECT a,b,c FROM arrtest;
> !        a       |       b       |         c
> ! ---------------+---------------+-------------------
> !  {16,25,3,4,5} | {{            | {}
> !  {}            | {3,4}         | {foo,new_word}
> !  {16,25,23}    | {{3,4},{4,5}} | {foobar,new_word}
>   (3 rows)
>
>   SELECT a[1:3],
>
> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
> that print wrong.  Very odd.  Maybe it's bad code on our part,
> but I think the odds are at least as good that it's a new gcc bug.
>
>                         regards, tom lane


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
So it started with GCC's revision r253859.
I'm investigating further.

Martin


On 19 March 2018 at 19:43, Martin Liška <marxin.liska@gmail.com> wrote:
> On 19 March 2018 at 19:20, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>>> On 03/19/2018 03:28 PM, Martin Liška wrote:
>>>>>> Note that building postgresql with -03, I see some array tests failing.
>>
>>> I'm getting failures in errors, union and alter_table, but none of those
>>> are related to arrays. So, which tests are failing for you and how do
>>> the failures look like?
>>
>> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
>> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
>> and indeed that's got some problems.  It looks like array_out fails
>> for multidimensional arrays, because all the diffs look about
>> like this one:
>
> I can confirm it's really caused by -O3 optimization level for the function:
> array_out
>
> If you give me couple of minutes, I will isolate why is that caused.
>
>>
>> *** 106,116 ****
>>     SET c[2:2] = '{"new_word"}'
>>     WHERE array_dims(c) is not null;
>>   SELECT a,b,c FROM arrtest;
>> !        a       |           b           |         c
>> ! ---------------+-----------------------+-------------------
>> !  {16,25,3,4,5} | {{{113,142},{1,147}}} | {}
>> !  {}            | {3,4}                 | {foo,new_word}
>> !  {16,25,23}    | {{3,4},{4,5}}         | {foobar,new_word}
>>   (3 rows)
>>
>>   SELECT a[1:3],
>> --- 106,116 ----
>>     SET c[2:2] = '{"new_word"}'
>>     WHERE array_dims(c) is not null;
>>   SELECT a,b,c FROM arrtest;
>> !        a       |       b       |         c
>> ! ---------------+---------------+-------------------
>> !  {16,25,3,4,5} | {{            | {}
>> !  {}            | {3,4}         | {foo,new_word}
>> !  {16,25,23}    | {{3,4},{4,5}} | {foobar,new_word}
>>   (3 rows)
>>
>>   SELECT a[1:3],
>>
>> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
>> that print wrong.  Very odd.  Maybe it's bad code on our part,
>> but I think the odds are at least as good that it's a new gcc bug.
>>
>>                         regards, tom lane


Re: BUG #15121: Multiple UBSAN errors

От
Andres Freund
Дата:
On 2018-03-19 14:41:23 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2018-03-19 14:20:33 -0400, Tom Lane wrote:
> >> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
> >> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
> >> and indeed that's got some problems.
> 
> >> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
> >> that print wrong.  Very odd.  Maybe it's bad code on our part,
> >> but I think the odds are at least as good that it's a new gcc bug.
> 
> > Might be worth trying with a new clang, I think it's been a bit ahead on
> > the quality of the ubsan (et al) integration quality.
> 
> I'm not talking about ubsan, I'm just talking about whether our regression
> tests pass with the higher -O level.

Oh. I think I'll setup two BF animals that continually run using
debian's gcc-snapshot package, once with O0 and once with O3.

Greetings,

Andres Freund


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
OK guys, you were right, it's miscompilation caused by GCC:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84969

Martin

On 19 March 2018 at 20:18, Andres Freund <andres@anarazel.de> wrote:
> On 2018-03-19 14:41:23 -0400, Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>> > On 2018-03-19 14:20:33 -0400, Tom Lane wrote:
>> >> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
>> >> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
>> >> and indeed that's got some problems.
>>
>> >> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
>> >> that print wrong.  Very odd.  Maybe it's bad code on our part,
>> >> but I think the odds are at least as good that it's a new gcc bug.
>>
>> > Might be worth trying with a new clang, I think it's been a bit ahead on
>> > the quality of the ubsan (et al) integration quality.
>>
>> I'm not talking about ubsan, I'm just talking about whether our regression
>> tests pass with the higher -O level.
>
> Oh. I think I'll setup two BF animals that continually run using
> debian's gcc-snapshot package, once with O0 and once with O3.
>
> Greetings,
>
> Andres Freund


Re: BUG #15121: Multiple UBSAN errors

От
Tomas Vondra
Дата:

On 03/19/2018 07:20 PM, Tom Lane wrote:
> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>> On 03/19/2018 03:28 PM, Martin Liška wrote:
>>>>> Note that building postgresql with -03, I see some array tests failing.
> 
>> I'm getting failures in errors, union and alter_table, but none of those
>> are related to arrays. So, which tests are failing for you and how do
>> the failures look like?
> 
> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
> and indeed that's got some problems.  It looks like array_out fails
> for multidimensional arrays, because all the diffs look about
> like this one:
> 
> *** 106,116 ****
>     SET c[2:2] = '{"new_word"}'
                   
 
>     WHERE array_dims(c) is not null;
                   
 
>   SELECT a,b,c FROM arrtest;
                   
 
> !        a       |           b           |         c
                   
 
> ! ---------------+-----------------------+-------------------
                   
 
> !  {16,25,3,4,5} | {{{113,142},{1,147}}} | {}
                   
 
> !  {}            | {3,4}                 | {foo,new_word}
                   
 
> !  {16,25,23}    | {{3,4},{4,5}}         | {foobar,new_word}
                   
 
>   (3 rows)
                   
 
>
                   
 
>   SELECT a[1:3],
                   
 
> --- 106,116 ----
>     SET c[2:2] = '{"new_word"}'
                   
 
>     WHERE array_dims(c) is not null;
                   
 
>   SELECT a,b,c FROM arrtest;
                   
 
> !        a       |       b       |         c
                   
 
> ! ---------------+---------------+-------------------
                   
 
> !  {16,25,3,4,5} | {{            | {}
                   
 
> !  {}            | {3,4}         | {foo,new_word}
                   
 
> !  {16,25,23}    | {{3,4},{4,5}} | {foobar,new_word}
                   
 
>   (3 rows)
                   
 
>
                   
 
>   SELECT a[1:3],
                   
 
> 
> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
> that print wrong.  Very odd.  Maybe it's bad code on our part,
> but I think the odds are at least as good that it's a new gcc bug.
> 

Interesting. If I run the tests with "-03" I get the same failures in
arrays. If I run them with "-O3 -fsanitize=undefined" I don't get any
failures in arrays, but I get failures in errors, union and alter_table.

I wouldn't expect -fsanitize=undefined to affect the results like this,
but if it really is a compiler bug then all bets are off.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Martin Liška
Дата:
On 19 March 2018 at 22:24, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>
>
> On 03/19/2018 07:20 PM, Tom Lane wrote:
>> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>>> On 03/19/2018 03:28 PM, Martin Liška wrote:
>>>>>> Note that building postgresql with -03, I see some array tests failing.
>>
>>> I'm getting failures in errors, union and alter_table, but none of those
>>> are related to arrays. So, which tests are failing for you and how do
>>> the failures look like?
>>
>> I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world
>> just fine.  Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28),
>> and indeed that's got some problems.  It looks like array_out fails
>> for multidimensional arrays, because all the diffs look about
>> like this one:
>>
>> *** 106,116 ****
>>     SET c[2:2] = '{"new_word"}'
>>     WHERE array_dims(c) is not null;
>>   SELECT a,b,c FROM arrtest;
>> !        a       |           b           |         c
>> ! ---------------+-----------------------+-------------------
>> !  {16,25,3,4,5} | {{{113,142},{1,147}}} | {}
>> !  {}            | {3,4}                 | {foo,new_word}
>> !  {16,25,23}    | {{3,4},{4,5}}         | {foobar,new_word}
>>   (3 rows)
>>
>>   SELECT a[1:3],
>> --- 106,116 ----
>>     SET c[2:2] = '{"new_word"}'
>>     WHERE array_dims(c) is not null;
>>   SELECT a,b,c FROM arrtest;
>> !        a       |       b       |         c
>> ! ---------------+---------------+-------------------
>> !  {16,25,3,4,5} | {{            | {}
>> !  {}            | {3,4}         | {foo,new_word}
>> !  {16,25,23}    | {{3,4},{4,5}} | {foobar,new_word}
>>   (3 rows)
>>
>>   SELECT a[1:3],
>>
>> Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper
>> that print wrong.  Very odd.  Maybe it's bad code on our part,
>> but I think the odds are at least as good that it's a new gcc bug.
>>
>
> Interesting. If I run the tests with "-03" I get the same failures in
> arrays. If I run them with "-O3 -fsanitize=undefined" I don't get any
> failures in arrays, but I get failures in errors, union and alter_table.
>
> I wouldn't expect -fsanitize=undefined to affect the results like this,

No, it's logical as the assembly is instrumented to process e.g.
boundary checking
each time an array is accessed. It explain why compiler can't optimize
as there are
new boundary which can't be crossed.

To be honest, sanitizers should report equal errors for all optimization errors.

Martin

> but if it really is a compiler bug then all bets are off.
>
> regards
>
> --
> Tomas Vondra                  http://www.2ndQuadrant.com
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: BUG #15121: Multiple UBSAN errors

От
Andres Freund
Дата:
On 2018-03-19 21:01:28 +0100, Martin Liška wrote:
> > Oh. I think I'll setup two BF animals that continually run using
> > debian's gcc-snapshot package, once with O0 and once with O3.

I've done that now. serinus (-O3) and flaviventris (-O0.


> OK guys, you were right, it's miscompilation caused by GCC:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84969

The current version of the gcc-snapshot package is from before the
commited fix. I've now updated, therefore we hopefully should see
serinus turn green again.

Greetings,

Andres Freund


Re: BUG #15121: Multiple UBSAN errors

От
Noah Misch
Дата:
On Sun, Mar 18, 2018 at 09:02:59PM -0400, Tom Lane wrote:
> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> > On 03/18/2018 08:59 PM, PG Bug reporting form wrote:
> >> arrayfuncs.c:3740:17: runtime error: member access within misaligned address
> >> 0x0000028b937c for type 'struct ExpandedObjectHeader', which requires 8 byte
> >> alignment

> What I think might be happening is that the compiler is taking the
> fact that the pointer is declared as AnyArrayType *, where
> 
> typedef union AnyArrayType
> {
>     ArrayType    flt;
>     ExpandedArrayHeader xpn;
> } AnyArrayType;
> 
> to assume that the pointer must be aligned on an 8-byte boundary because
> ExpandedArrayHeader would require that, even if we're only accessing the
> "flt" member.

Yep.

> Maybe that's a live problem, though we've seen no related
> trouble reports.  It'd require the compiler to generate 8-byte-aligned
> instructions for accessing the ArrayType header, which doesn't seem all
> that probable.

Using different casts, as attached, silences these complaints without much
change in code cosmetics.  DatumGetAnyArrayP() already assumes one can cast
between AnyArrayType and ArrayType, so this doesn't introduce new assumptions.
This is enough to make my infrequent "gcc -fsanitize=undefined
-fno-sanitize=nonnull-attribute" runs complaint-free under gcc 8.3.0 on
sparc64.  (I use -fno-sanitize=nonnull-attribute to avoid the complaints about
memcpy(NULL, NULL, 0) and such.  While formally undefined, fixes for those
would be uglier, and I expect we'll learn quickly enough if some
implementation treats them as other than a no-op.)

Вложения

Re: BUG #15121: Multiple UBSAN errors

От
Tom Lane
Дата:
Noah Misch <noah@leadboat.com> writes:
> On Sun, Mar 18, 2018 at 09:02:59PM -0400, Tom Lane wrote:
>> What I think might be happening is that the compiler is taking the
>> fact that the pointer is declared as AnyArrayType *, where ...
>> to assume that the pointer must be aligned on an 8-byte boundary because
>> ExpandedArrayHeader would require that, even if we're only accessing the
>> "flt" member.

> Yep.

> Using different casts, as attached, silences these complaints without much
> change in code cosmetics.

I'd intentionally avoided using casts this way as an attempt to ensure
that these macros weren't accidentally applied to the wrong kind of
pointer.  However, avoiding UBSAN complaints (and perhaps wrong code
generation) seems like a more important goal.  This patch looks OK to me.

            regards, tom lane