Bug 61905 - zero variable length array bound in cp-demangle.c cplus_demangle_print_callback
Summary: zero variable length array bound in cp-demangle.c cplus_demangle_print_callback
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: demangler (show other bugs)
Version: 4.9.1
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: ubsan
  Show dependency treegraph
 
Reported: 2014-07-25 08:13 UTC by Vittorio Zecca
Modified: 2021-08-26 06:40 UTC (History)
1 user (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-09-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Zecca 2014-07-25 08:13:16 UTC
The sanitizer claims that compiling the testsuite files pr21255-2-mb.c and
pr21255-4.c and pr21255-3.c and pr21255-2-ml.c
a zero variable length array bound occurs
"../../gcc-4.9.1/libiberty/cp-demangle.c:4039:40: runtime error: 
variable length array bound evaluates to non-positive value 0"

Same at line 4040
"    __extension__ struct d_saved_scope scopes[dpi.num_saved_scopes];
    __extension__ struct d_print_template temps[dpi.num_copy_templates];"
Comment 1 Marek Polacek 2014-09-04 09:48:11 UTC
I see:
$ ./xgcc -B./ -c pr21255-2-mb.c 
pr21255-2-mb.c: In function ‘f’:
pr21255-2-mb.c:19:1: internal compiler error: in ix86_print_operand, at config/i386/i386.c:15232
 }
 ^
/home/polacek/src/gcc/libiberty/cp-demangle.c:4065:40: runtime error: variable length array bound evaluates to non-positive value 0
/home/polacek/src/gcc/libiberty/cp-demangle.c:4066:43: runtime error: variable length array bound evaluates to non-positive value 0
0x21383e3 ix86_print_operand(_IO_FILE*, rtx_def*, int)
	/home/polacek/src/gcc/gcc/config/i386/i386.c:15232
0xd2a08e output_operand(rtx_def*, int)
	/home/polacek/src/gcc/gcc/final.c:3850
0xd2b67c output_asm_insn(char const*, rtx_def**)
	/home/polacek/src/gcc/gcc/final.c:3748
0xd2f8c7 final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*)
	/home/polacek/src/gcc/gcc/final.c:2635
0xd31894 final(rtx_insn*, _IO_FILE*, int)
	/home/polacek/src/gcc/gcc/final.c:2063
0xd33b22 rest_of_handle_final
	/home/polacek/src/gcc/gcc/final.c:4472
0xd33b22 execute
	/home/polacek/src/gcc/gcc/final.c:4547
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 2 Markus Trippelsdorf 2014-09-28 09:30:50 UTC
Started with r206362.
Comment 3 Jakub Jelinek 2014-10-30 10:38:21 UTC
GCC 4.9.2 has been released.
Comment 4 Jakub Jelinek 2015-06-26 19:54:16 UTC
GCC 4.9.3 has been released.