https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120058

            Bug ID: 120058
           Summary: internal compiler error: Segmentation fault
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tharakan at gmail dot com
  Target Milestone: ---

Created attachment 61266
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61266&action=edit
This is the .i file for the c file that's failing.

Hi,

When compiling Postgres, I see a compiler error which appears similar to this
bug [1] (w.r.t. tree_check()), but the stack trace is quite different. I also
saw a few ICE bugs but they didn't appear to be a recent change (see git commit
below), and thus posting separately.

This postgres buildfarm machine has been running ~hourly gcc compiles for a few
months, but suddenly started to fail today [3] reproducibly, which doesn't seem
to be Postgres related [4]. Error excerpt below and (.i) file are attached. 

Triaging gcc commits, b6d37ec1dd2a228d94e7b5b438f3aa53684316bc seems
interesting.

(make -k check has been running for a few hours, I'll update here if that leads
me to something)

Git Triaging
------------
$ git log | grep ^commit | head -20
commit 262a89fae6344e5c4e410da1dd5ffafbcee49fc0
commit 25921d664242f651ed8a25b3db55093a19a5ae7b - fail
commit 87c4460024dadef0aa1c767be146ad3831857ebe - fail
commit b6d37ec1dd2a228d94e7b5b438f3aa53684316bc - fail
commit 08ce1b9f6707e00089c4d77d2bb82963d531bb1d - success
commit 9f523d49ada91050445f71821a9a06b0988402f5 - success
commit bbc96c9c09921ca7d59564851d0ed6dcd918c300 - success
commit 1fb5abc3919f376f3dedccad636eba4a4ad7e4a7
commit 0abc77da9d704bba55a376bb5c162a54826ab94a
commit 05df554536a8d33f4c438cfc7b006b3b2083246a - success
commit 5c917a585d765b0878afd9435e3b3eece9f820f9
commit 51bccb94a74fd5c44b6cc9cc8b9b1a831da8ec8d
commit 25fe59805029e164bfbe347adbdf62856d1b1b1e
commit aa6f1df4ec46a20d2292291b192d3331e51b59f8
commit d90d9ba058fb54e1138efab273e06ec9cc6014d0
commit 52d3352239f73d3c165550177b4fe917760b85f9
commit 79aa2a283a8d3327ff4d6dca77e81d5b1ac3a01e - success
commit a5d89deeaed7ba8ae42e262395a4cd31f878f3e8
commit fb4583566afdee50aad12e1219610813b44bdff4
commit d613678c94f06809656e56b37f314501b37a5ddd



Error
-----
$ gcc -v -save-temps -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-deprecated-non-prototype -Wno-format-truncation -Wno-stringop-truncation
-g -O2 -std=gnu17 -I../../../src/include  -D_GNU_SOURCE -I/usr/include/libxml2 
 -c -o nodeFuncs.o nodeFuncs.c
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: /opt/gcc/source/configure --prefix=/opt/gcc/target
--disable-multilib : (reconfigured) /opt/gcc/source/configure
--prefix=/opt/gcc/target --disable-multilib : (reconfigured)
/opt/gcc/source/configure --prefix=/opt/gcc/target --disable-multilib
--enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250501 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wmissing-prototypes'
'-Wpointer-arith' '-Wdeclaration-after-statement' '-Werror=vla'
'-Wendif-labels' '-Wsuggest-attribute=format' '-Wimplicit-fallthrough=3'
'-Wcast-function-type' '-Wformat-security' '-fno-strict-aliasing' '-fwrapv'
'-fexcess-precision=standard' '-Wno-deprecated-non-prototype'
'-Wformat-truncation=0' '-Wno-stringop-truncation' '-g' '-O2' '-std=gnu17' '-I'
'../../../src/include' '-D' '_GNU_SOURCE' '-I' '/usr/include/libxml2' '-c' '-o'
'nodeFuncs.o' '-mtune=generic' '-march=x86-64'
 /opt/gcc/prod/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/cc1 -E -quiet -v
-I ../../../src/include -I /usr/include/libxml2 -imultiarch x86_64-linux-gnu
-iprefix /opt/gcc/prod/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/ -D
_GNU_SOURCE nodeFuncs.c -mtune=generic -march=x86-64 -std=gnu17 -Wall
-Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla
-Wendif-labels -Wsuggest-attribute=format -Wimplicit-fallthrough=3
-Wcast-function-type -Wformat-security -Wno-deprecated-non-prototype
-Wformat-truncation=0 -Wno-stringop-truncation -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -g -fworking-directory -O2 -fpch-preprocess -o
nodeFuncs.i
ignoring nonexistent directory
"/opt/gcc/prod/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/include-fixed/x86_64-linux-gnu"
ignoring nonexistent directory
"/opt/gcc/prod/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory
"/opt/gcc/prod/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/16.0.0/include"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/opt/gcc/prod/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/16.0.0/include-fixed/x86_64-linux-gnu"
ignoring duplicate directory
"/opt/gcc/prod/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/16.0.0/include-fixed"
ignoring nonexistent directory
"/opt/gcc/prod/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/16.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 ../../../src/include
 /usr/include/libxml2
 /opt/gcc/prod/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/include
 /opt/gcc/prod/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.0/include-fixed
 /usr/local/include
 /opt/gcc/prod/bin/../lib/gcc/../../include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wmissing-prototypes'
'-Wpointer-arith' '-Wdeclaration-after-statement' '-Werror=vla'
'-Wendif-labels' '-Wsuggest-attribute=format' '-Wimplicit-fallthrough=3'
'-Wcast-function-type' '-Wformat-security' '-fno-strict-aliasing' '-fwrapv'
'-fexcess-precision=standard' '-Wno-deprecated-non-prototype'
'-Wformat-truncation=0' '-Wno-stringop-truncation' '-g' '-O2' '-std=gnu17' '-I'
'../../../src/include' '-D' '_GNU_SOURCE' '-I' '/usr/include/libxml2' '-c' '-o'
'nodeFuncs.o' '-mtune=generic' '-march=x86-64'
 /opt/gcc/prod/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/cc1 -fpreprocessed
nodeFuncs.i -quiet -dumpbase nodeFuncs.c -dumpbase-ext .c -mtune=generic
-march=x86-64 -g -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wsuggest-attribute=format -Wimplicit-fallthrough=3 -Wcast-function-type
-Wformat-security -Wno-deprecated-non-prototype -Wformat-truncation=0
-Wno-stringop-truncation -std=gnu17 -version -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -o nodeFuncs.s
GNU C17 (GCC) version 16.0.0 20250501 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 16.0.0 20250501 (experimental), GMP version
6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 1595b8feb42ed5b4136e55368db04a28
nodeFuncs.c: In function ‘expression_tree_walker’:
nodeFuncs.c:1949:25: internal compiler error: Segmentation fault
 1949 |                         return walker(((WithCheckOption *) node)->qual,
context);
      |                         ^~~~~~
0x263119f internal_error(char const*, ...)
        /opt/gcc/source/gcc/diagnostic-global-context.cc:517
0x1131fef crash_signal
        /opt/gcc/source/gcc/toplev.cc:321
0x75a3c964532f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xa30a1f tree_check(tree_node const*, char const*, int, char const*, tree_code)
        /opt/gcc/source/gcc/tree.h:3979
0xa30a1f fndecl_built_in_p(tree_node const*)
        /opt/gcc/source/gcc/tree.h:6922
0xa30a1f convert_arguments
        /opt/gcc/source/gcc/c/c-typeck.cc:4340
0xa30a1f build_function_call_vec(unsigned long, vec<unsigned long, va_heap,
vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc,
vl_embed>*, tree_node*)
        /opt/gcc/source/gcc/c/c-typeck.cc:3881
0xa7c194 c_parser_postfix_expression_after_primary
        /opt/gcc/source/gcc/c/c-parser.cc:13735
0xa58893 c_parser_postfix_expression
        /opt/gcc/source/gcc/c/c-parser.cc:13286
0xa5deaa c_parser_unary_expression
        /opt/gcc/source/gcc/c/c-parser.cc:10604
0xa5fb1b c_parser_cast_expression
        /opt/gcc/source/gcc/c/c-parser.cc:10445
0xa5ff0f c_parser_binary_expression
        /opt/gcc/source/gcc/c/c-parser.cc:10213
0xa61523 c_parser_conditional_expression
        /opt/gcc/source/gcc/c/c-parser.cc:9908
0xa61d24 c_parser_expr_no_commas
        /opt/gcc/source/gcc/c/c-parser.cc:9821
0xa62187 c_parser_expression
        /opt/gcc/source/gcc/c/c-parser.cc:13875
0xa629b7 c_parser_expression_conv
        /opt/gcc/source/gcc/c/c-parser.cc:13934
0xa556bd c_parser_statement_after_labels
        /opt/gcc/source/gcc/c/c-parser.cc:8226
0xa58541 c_parser_compound_statement_nostart
        /opt/gcc/source/gcc/c/c-parser.cc:7757
0xa8cad7 c_parser_compound_statement
        /opt/gcc/source/gcc/c/c-parser.cc:6975
0xa54029 c_parser_statement_after_labels
        /opt/gcc/source/gcc/c/c-parser.cc:8163
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.



Reference:
1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120039
2. Attached nodefuncs.i 
3.
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=alligator&dt=2025-05-01%2018%3A56%3A11
4.
https://www.postgresql.org/message-id/flat/CAEP4nAxj2rnT87iLQu2%2BHUFadybovwQAx67_W12L0nxXRWRi0g%40mail.gmail.com#33144e23b1a0019f278df8d63fd9200f

Reply via email to