https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125128
Bug ID: 125128
Summary: Driver crash in context::action_after_output after ICE
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: ats-gccbugs at offog dot org
Target Milestone: ---
Created attachment 64337
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64337&action=edit
Example ICE with 16.1.0
I've attached a piece of (nonsense) code that produces an ICE with 16.1.0.
Here's the same thing on Compiler Explorer, where it behaves the same on 16.1.0
and trunk: https://godbolt.org/z/1ebsbdoTn
I'll file a separate bug for the ICE itself, but I noticed that the driver is
actually crashing as well before printing the "Please submit a full bug report"
message.
The backtrace is below. It appears to be a result of the change in
358ab6c5ab4d70967ba83a8b5fc426c34d628316 that makes
context::action_after_output print out argv. The code assumes that
m_original_argv isn't nullptr, but context::set_original_argv has never been
called in the driver - it's called from toplev::main but not driver::main.
#0 diagnostics::context::action_after_output (this=this@entry=0x620d20
<global_diagnostic_context>, diag_kind=<optimized out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/diagnostics/context.cc:1027
#1 0x0000000000496f2c in diagnostics::context::report_diagnostic
(this=this@entry=0x620d20 <global_diagnostic_context>,
diagnostic=diagnostic@entry=0x7fffffffd140) at
/src/devel/gcc/work/gcc-16.1.0/gcc/diagnostics/context.cc:1562
#2 0x0000000000496b18 in diagnostics::context::diagnostic_impl (this=0x620d20
<global_diagnostic_context>, richloc=richloc@entry=0x7fffffffd258,
metadata=metadata@entry=0x0, opt_id=..., opt_id@entry=...,
gmsgid=gmsgid@entry=0x4f79f0 "%s signal terminated program %s",
ap=ap@entry=0x7fffffffd240,
kind=diagnostics::kind::ice_nobt) at
/src/devel/gcc/work/gcc-16.1.0/gcc/diagnostics/context.cc:1689
#3 0x0000000000423ef8 in internal_error_no_backtrace
(gmsgid=gmsgid@entry=0x4f79f0 "%s signal terminated program %s")
at /src/devel/gcc/work/gcc-16.1.0/gcc/diagnostics/option-id.h:35
#4 0x000000000040c642 in execute () at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:3540
#5 0x000000000048fd1d in do_spec_1 (spec=spec@entry=0x669a30 "-o %|.s |\n as
%(asm_options) %m.s %A", soft_matched_part=soft_matched_part@entry=0x0,
inswitch=0) at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6201
#6 0x00000000004905e3 in process_brace_body (p=0x669d52 "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#7 handle_braces (p=<optimized out>, p@entry=0x669d2a "!S:-o %|.s |\n as
%(asm_options) %m.s %A }") at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#8 0x000000000048f0c0 in do_spec_1 (
spec=spec@entry=0x669ce0 "
%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()} %{!S:-o
%|.s |\n as %(asm_options) %m.s %A }",
soft_matched_part=soft_matched_part@entry=0x0, inswitch=0) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#9 0x00000000004905e3 in process_brace_body (p=0x4fbc96 "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#10 handle_braces (p=<optimized out>,
p@entry=0x4fbc1a "!fwpa*:
%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()} %{!S:-o
%|.s |\n as %(asm_options) %m.s %A } }")
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#11 0x000000000048f0c0 in do_spec_1 (
spec=0x4fbc18 "%{!fwpa*:
%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()} %{!S:-o
%|.s |\n as %(asm_options) %m.s %A } }",
soft_matched_part=soft_matched_part@entry=0x0, inswitch=0) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#12 0x000000000048f603 in do_spec_1 (spec=spec@entry=0x666470 "%(invoke_as)",
soft_matched_part=soft_matched_part@entry=0x0, inswitch=0)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6982
#13 0x00000000004905e3 in process_brace_body (p=0x646ef3 "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#14 handle_braces (p=<optimized out>, p@entry=0x646ed9
"!fmodule-only:%(invoke_as)}") at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#15 0x000000000048f0c0 in do_spec_1 (spec=spec@entry=0x646eb0 "
%{fmodule-only:%{!S:-o %g.s%V}} %{!fmodule-only:%(invoke_as)}",
soft_matched_part=soft_matched_part@entry=0x0, inswitch=0) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#16 0x00000000004905e3 in process_brace_body (p=0x669a20 "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#17 handle_braces (p=<optimized out>, p@entry=0x6699ce "!fsyntax-only:
%{fmodule-only:%{!S:-o %g.s%V}} %{!fmodule-only:%(invoke_as)}}")
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#18 0x000000000048f0c0 in do_spec_1 (
spec=spec@entry=0x6698a0 " %{save-temps*|no-integrated-cpp:cc1plus -E\t
%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n} cc1plus
%{save-temps*|no-integrated-cpp:-fpreprocessed \t %{save-temps*:%b.ii}
%{!s"..., soft_matched_part=soft_matched_part@entry=0x0, inswitch=0)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#19 0x00000000004905e3 in process_brace_body (p=0x669887 "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#20 handle_braces (p=<optimized out>,
p@entry=0x669702 "!MM: %{save-temps*|no-integrated-cpp:cc1plus -E\t
%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n} cc1plus
%{save-temps*|no-integrated-cpp:-fpreprocessed \t %{save-temps*:%b.ii} "...)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#21 0x000000000048f0c0 in do_spec_1 (
spec=spec@entry=0x669700 "%{!MM: %{save-temps*|no-integrated-cpp:cc1plus
-E\t %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}
cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed \t
%{save-temps*:%b.ii"..., soft_matched_part=soft_matched_part@entry=0x0,
inswitch=0)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#22 0x00000000004905e3 in process_brace_body (p=0x6696ed "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#23 handle_braces (p=<optimized out>,
p@entry=0x669562 "!M:%{!MM: %{save-temps*|no-integrated-cpp:cc1plus -E\t
%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n} cc1plus
%{save-temps*|no-integrated-cpp:-fpreprocessed \t %{save-temps*:%b"...) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#24 0x000000000048f0c0 in do_spec_1 (
spec=spec@entry=0x669560 "%{!M:%{!MM:
%{save-temps*|no-integrated-cpp:cc1plus -E\t %(cpp_options) %2 -o
%{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n} cc1plus
%{save-temps*|no-integrated-cpp:-fpreprocessed \t %{save-temps*:"...,
soft_matched_part=soft_matched_part@entry=0x0, inswitch=0)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#25 0x00000000004905e3 in process_brace_body (p=0x4fa50e "}", atom=<optimized
out>, end_atom=<optimized out>, starred=<optimized out>, matched=<optimized
out>)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7553
#26 handle_braces (p=<optimized out>,
p@entry=0x4fa37d "!E:%{!M:%{!MM: %{save-temps*|no-integrated-cpp:cc1plus
-E\t %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}
cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed \t %{save-temp"...) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:7460
#27 0x000000000048f0c0 in do_spec_1 (
spec=0x4fa340 "%{E|M|MM:cc1plus -E %(cpp_options) %2
%(cpp_debug_options)}%{!E:%{!M:%{!MM: %{save-temps*|no-integrated-cpp:cc1plus
-E\t %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}
cc1plus %"..., soft_matched_part=soft_matched_part@entry=0x0, inswitch=0)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:6867
#28 0x000000000048eefc in do_spec_2 (spec=<optimized out>,
soft_matched_part=0x0) at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:5894
#29 0x00000000004b11ea in do_spec (spec=<optimized out>) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:5858
#30 0x00000000004b1103 in driver::do_spec_on_infiles
(this=this@entry=0x7fffffffe5b0) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:9119
#31 0x000000000048acb4 in driver::main (this=this@entry=0x7fffffffe5b0,
argc=<optimized out>, argc@entry=5, argv=<optimized out>,
argv@entry=0x7fffffffe708)
at /src/devel/gcc/work/gcc-16.1.0/gcc/gcc.cc:8334
#32 0x000000000048ad14 in main (argc=5, argv=0x7fffffffe708) at
/src/devel/gcc/work/gcc-16.1.0/gcc/gcc-main.cc:47