https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123796
Bug ID: 123796
Summary: [16 Regression] ./tzdata.zi.h:1:1: internal compiler
error: Segmentation fault
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: danglin at gcc dot gnu.org
CC: vmakarov at gcc dot gnu.org
Target Milestone: ---
Host: hppa64-hp-hpux11.11
Target: hppa64-hp-hpux11.11
Build: hppa64-hp-hpux11.11
The following ICE occurs in stage2:
libtool: compile: /home/dave/gnu/gcc/objdir64/./gcc/xgcc -shared-libgcc
-B/home/dave/gnu/gcc/objdir64/./gcc -nostdinc++
-L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/src
-L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/src/.libs
-L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/libsupc++/.libs
-B/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/bin/
-B/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/lib/ -isystem
/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/include -isystem
/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/sys-include -fno-checking
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/../libgcc
-I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11
-I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++ -std=gnu++20 -D_GLIBCXX_SHARED
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=tzdb.lo -fimplicit-templates -O2 -g -I. -c
../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc -DPIC -D_GLIBCXX_SHARED -o
tzdb.o
In file included from ../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc:1195:
./tzdata.zi.h:1:1: internal compiler error: Segmentation fault
1 | static const char tzdata_chars[] = R"__libstdcxx__(
| ^~~~~~
0x4000000002004e5f internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:787
0x40000000011ae9cb crash_signal
../../gcc/gcc/toplev.cc:325
0x40000000020907c0 lex_raw_string
../../gcc/libcpp/lex.cc:2749
0x40000000020907c0 lex_string
../../gcc/libcpp/lex.cc:2886
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.
make[6]: *** [Makefile:757: tzdb.lo] Error 1
make[6]: *** Waiting for unfinished jobs....
make[6]: Leaving directory
'/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/src/c++20'
make[5]: *** [Makefile:800: all-recursive] Error 1
make[5]: Leaving directory
'/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/src'
This ICE was first observed after this commit:
bash-5.1$ git bisect bad
3ebe697f32197ec4a429fbf8dd9cce3155c0c9ba is the first bad commit
commit 3ebe697f32197ec4a429fbf8dd9cce3155c0c9ba
Author: Andrew Pinski <[email protected]>
Date: Fri Jan 9 02:02:01 2026 -0800
cfgcleanup: Protect latches always [PR123417]
So it turns out LOOPS_MAY_HAVE_MULTIPLE_LATCHES is set in places
along compiling. Setting it only means there might be multiple
latches currently. It does not mean let's go in an delete them
all; which is what remove_forwarder_block does currently. This
was happening before my set of patches too but since it was
only happening in merge_phi pass, latches were not cleared away
al of the time and then recreated.
This solves the problem by protecting latches all of the time
instead of depedent on LOOPS_MAY_HAVE_MULTIPLE_LATCHES not being set.
vect-uncounted_7.c needs to be xfailed here because we no longer
vectorize the code. Note the IR between GCC 15 and after this patch
is the same so I think this was just a case were the testcase
was added after the remove forwarder changes and should not have
vectorized (or vectorize differently).
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/123417
gcc/ChangeLog:
* tree-cfgcleanup.cc (maybe_remove_forwarder_block): Always
protect latches.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/vect-uncounted_7.c: xfail vect test.
Signed-off-by: Andrew Pinski <[email protected]>
gcc/testsuite/gcc.dg/vect/vect-uncounted_7.c | 4 ++--
gcc/tree-cfgcleanup.cc | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)
bash-5.1$ git bisect log
git bisect start
# bad: [8ec17a01f1fc76a53f0f2a7e0cff0c460aac4635] Daily bump.
git bisect bad 8ec17a01f1fc76a53f0f2a7e0cff0c460aac4635
# good: [c7206efa282bdd121ae4bd5227b487d06c3874c2] widening_mul: Fix up
.SAT_{ADD,SUB,MUL} pattern recognition [PR123372]
git bisect good c7206efa282bdd121ae4bd5227b487d06c3874c2
# good: [4a2e1c31159aab4bde1990589ccab0da2436dfad] Add publish/subscribe topics
and channel: pass_events
git bisect good 4a2e1c31159aab4bde1990589ccab0da2436dfad
# bad: [460edeb8bea11e0d7e7005357d65082d74ff406b] Daily bump.
git bisect bad 460edeb8bea11e0d7e7005357d65082d74ff406b
# bad: [da5a5c55284969a1b99192b90571a21848a6446f] libstdc++: Fix
generate_cannonical test for 128bit floating points.
git bisect bad da5a5c55284969a1b99192b90571a21848a6446f
# bad: [87222af419eb272d4b66628abda573ba8fcadc77] CRIS: Handle POST_INC in
cris_rtx_costs
git bisect bad 87222af419eb272d4b66628abda573ba8fcadc77
# good: [2226b67bbe2bfdce51623db31059169850c52a7b] libstdc++: constexpr
flat_map and flat_multimap
git bisect good 2226b67bbe2bfdce51623db31059169850c52a7b
# bad: [a0aa9a2b61fd3f61db6a5d95c51fd0f25c2cd322] Ada, Darwin: Fix bootstrap
after recent warning improvements.
git bisect bad a0aa9a2b61fd3f61db6a5d95c51fd0f25c2cd322
# good: [5079424ade2deddfa8d39a48a892f60679e4e32d] toplevel: Unbreak Ada build
[PR123490]
git bisect good 5079424ade2deddfa8d39a48a892f60679e4e32d
# bad: [972be84265c2f8a57ca651256c307486482582c6] libstdc++: Fix
std::system_category().message(int) on mingw32 target
git bisect bad 972be84265c2f8a57ca651256c307486482582c6
# bad: [3ebe697f32197ec4a429fbf8dd9cce3155c0c9ba] cfgcleanup: Protect latches
always [PR123417]
git bisect bad 3ebe697f32197ec4a429fbf8dd9cce3155c0c9ba
# first bad commit: [3ebe697f32197ec4a429fbf8dd9cce3155c0c9ba] cfgcleanup:
Protect latches always [PR123417]
It is caused by incorrect register order in a memory load:
(gdb) r
Starting program: /home/dave/gnu/gcc/objdir64/gcc/cc1plus -E -quiet -nostdinc++
-v -I /home/dave/gnu/gcc/gcc/libstdc++-v3/../libgcc -I
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11
-I /home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include -I
/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++ -I . -iprefix
/home/dave/gnu/gcc/objdir64/gcc/../lib/gcc/hppa64-hp-hpux11.11/16.0.0/ -isystem
/home/dave/gnu/gcc/objdir64/./gcc/include -isystem
/home/dave/gnu/gcc/objdir64/./gcc/include-fixed -D _GLIBCXX_SHARED -D PIC -D
_GLIBCXX_SHARED -isystem /opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/include
-isystem /opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/sys-include
../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc -std=gnu++20 -Wall -Wextra
-Wwrite-strings -Wcast-qual -Wabi=19 -fno-checking
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=tzdb.lo -fimplicit-templates -g -fworking-directory -O2
-fpch-preprocess -o tzdb.ii
warning: Private mapping of shared library text was not specified
by the executable; setting a breakpoint in a shared library which
is not privately mapped will not work. See the HP-UX 11i v3 chatr
manpage for methods to privately map shared library text.
ignoring nonexistent directory
"/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/include"
ignoring nonexistent directory
"/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/sys-include"
ignoring nonexistent directory
"/home/dave/gnu/gcc/objdir64/gcc/../lib/gcc/hppa64-hp-hpux11.11/16.0.0/include"
ignoring nonexistent directory
"/home/dave/gnu/gcc/objdir64/gcc/../lib/gcc/hppa64-hp-hpux11.11/16.0.0/include-fixed"
ignoring nonexistent directory
"/home/dave/gnu/gcc/objdir64/gcc/../lib/gcc/hppa64-hp-hpux11.11/16.0.0/../../../../hppa64-hp-hpux11.11/include"
ignoring nonexistent directory
"/opt/gnu64/gcc/gcc-16/lib/gcc/hppa64-hp-hpux11.11/16.0.0/../../../../hppa64-hp-hpux11.11/include"
#include "..." search starts here:
#include <...> search starts here:
/home/dave/gnu/gcc/gcc/libstdc++-v3/../libgcc
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include
/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++
.
/home/dave/gnu/gcc/objdir64/./gcc/include
/home/dave/gnu/gcc/objdir64/./gcc/include-fixed
/opt/gnu64/gcc/gcc-16/lib/gcc/hppa64-hp-hpux11.11/16.0.0/include
/opt/gnu64/include
/opt/gnu64/gcc/gcc-16/include
/opt/gnu64/gcc/gcc-16/lib/gcc/hppa64-hp-hpux11.11/16.0.0/include-fixed
/usr/include
End of search list.
Program received signal SIGSEGV, Segmentation fault.
lex_raw_string (pfile=<optimized out>, token=<optimized out>,
base=<optimized out>) at ../../gcc/libcpp/lex.cc:2749
2749 if (prefix[phase] != c)
(gdb) disass $pc-16,$pc+16
Dump of assembler code from 0x40000000020907b0 to 0x40000000020907d0:
0x40000000020907b0 <lex_string(cpp_reader*, cpp_token*, uchar const*)+1740>:
cmpib,= -2,r15,0x400000000209084c <lex_string(cpp_reader*, cpp_token*, uchar
const*)+1896>
0x40000000020907b4 <lex_string(cpp_reader*, cpp_token*, uchar const*)+1744>:
ldi 28,ret0
0x40000000020907b8 <lex_string(cpp_reader*, cpp_token*, uchar const*)+1748>:
cmpib,= -1,r15,0x40000000020907cc <lex_string(cpp_reader*, cpp_token*, uchar
const*)+1768>
0x40000000020907bc <lex_string(cpp_reader*, cpp_token*, uchar const*)+1752>:
ldo -130(sp),ret0
=> 0x40000000020907c0 <lex_string(cpp_reader*, cpp_token*, uchar const*)+1756>:
ldb ret0(r15),ret0
0x40000000020907c4 <lex_string(cpp_reader*, cpp_token*, uchar const*)+1760>:
cmpb,= r12,ret0,0x4000000002090b68 <lex_string(cpp_reader*, cpp_token*, uchar
const*)+2692>
0x40000000020907c8 <lex_string(cpp_reader*, cpp_token*, uchar const*)+1764>:
ldo 1(r15),ret0
0x40000000020907cc <lex_string(cpp_reader*, cpp_token*, uchar const*)+1768>:
or,>= r0,r9,ret0
End of assembler dump.
(gdb) p/x $ret0
$3 = 0x800003ffbfff22b0
(gdb) p/x $r15
$4 = 0x0
(gdb) bt
#0 lex_raw_string (pfile=<optimized out>, token=<optimized out>,
base=<optimized out>) at ../../gcc/libcpp/lex.cc:2749
#1 lex_string (pfile=0x80000001003d9998, token=0x8000000100464f60,
base=<optimized out>) at ../../gcc/libcpp/lex.cc:2886
#2 0x4000000002091da4 in _cpp_lex_direct (pfile=0x800000010059488d)
at ../../gcc/libcpp/lex.cc:4021
#3 0x4000000002093b08 in _cpp_lex_token (pfile=0x80000001003d9998)
at ../../gcc/libcpp/lex.cc:3739
#4 0x400000000209c28c in cpp_get_token_1 (pfile=0x80000001003d9998,
location=0xe) at ../../gcc/libcpp/macro.cc:3025
#5 0x400000000209e3d8 in cpp_get_token_with_location (pfile=<optimized out>,
loc=<optimized out>) at ../../gcc/libcpp/macro.cc:3311
#6 0x4000000000ad606c in scan_translation_unit (pfile=0x80000001003d9998)
at ../../gcc/gcc/c-family/c-ppoutput.cc:412
#7 preprocess_file (pfile=0x80000001003d9998)
at ../../gcc/gcc/c-family/c-ppoutput.cc:114
#8 0x4000000000ad2cfc in c_common_init ()
at ../../gcc/gcc/c-family/c-opts.cc:1401
#9 0x400000000085fe58 in cxx_init () at ../../gcc/gcc/cp/lex.cc:425
#10 0x40000000023da564 in lang_dependent_init (
name=0xe <error: Cannot access memory at address 0xe>)
at ../../gcc/gcc/toplev.cc:1912
#11 do_compile () at ../../gcc/gcc/toplev.cc:2210
---Type <return> to continue, or q <return> to quit---
#12 toplev::main (this=0x800003ffbfff1968, argc=<optimized out>,
argv=<optimized out>) at ../../gcc/gcc/toplev.cc:2390
#13 0x40000000023dc21c in main (argc=5851277, argv=0x80000001003d9998)
at ../../gcc/gcc/main.cc:39
(insn 936 4643 6953 (set (reg:SI 28 %r28 [orig:569 _217 ] [569])
(zero_extend:SI (mem:QI (plus:DI (reg/v/f:DI 15 %r15 [orig:136 phase+-4
] [136])
(reg:DI 28 %r28 [1055])) [0 prefix[phase_185]+0 S1 A8])))
"../../gcc/libcpp/lex.cc":2749:20 140 {*pa.md:4753}
(nil))
(define_insn ""
[(set (match_operand:SI 0 "register_operand" "=r,r")
(zero_extend:SI
(match_operand:QI 1 "move_src_operand" "r,RQ")))]
"GET_CODE (operands[1]) != CONST_INT"
"@
{extru|extrw,u} %1,31,8,%0
ldb%M1 %1,%0"
[(set_attr "type" "shift,load")
(set_attr "length" "4,4")])
%r15 has frame pointer flag set but probably it shouldn't. The %r28 operand in
the mem should have frame related flag set.
lex.cc.322r.ira
(insn 934 931 936 86 (set (reg/f:DI 568)
(plus:DI (reg/f:DI 998)
(reg/v/f:DI 136 [ phase+-4 ]))) "../../gcc/libcpp/lex.cc":2749:20
171 {*pa.md:5133}
(nil))
(insn 936 934 937 86 (set (reg:SI 569 [ _217 ])
(zero_extend:SI (mem:QI (reg/f:DI 568) [0 prefix[phase_185]+0 S1 A8])))
"../../gcc/libcpp/lex.cc":2749:20 140 {*pa.md:4753}
(expr_list:REG_DEAD (reg/f:DI 568)
(nil)))
lex.cc.323r.reload:
(insn 934 3601 936 86 (set (reg/f:DI 28 %r28 [568])
(plus:DI (reg:DI 28 %r28 [1055])
(reg/v/f:DI 15 %r15 [orig:136 phase+-4 ] [136])))
"../../gcc/libcpp/lex.cc":2749:20 171 {*pa.md:5133}
(nil))
(insn 936 934 937 86 (set (reg:SI 28 %r28 [orig:569 _217 ] [569])
(zero_extend:SI (mem:QI (reg/f:DI 28 %r28 [568]) [0 prefix[phase_185]+0
S1 A8]))) "../../gcc/libcpp/lex.cc":2749:20 140 {*pa.md:4753}
(nil))
LRA dropped the frame related flag in substituting hard register %r28 for
pseudo reg/f:DI 568.
reg/v/f:DI 136 has the frame related flag set but likely it shouldn't be set.
Together, this causes PA back end to out a ldb instruction with an incorrect
register incorrect register order.
Insns 934 and 936 are only combined if only one of DI 568 and DI 136 have the
frame related set.
Hopefully, reload can be adjusted to retain frame related flags in register
substitutions.