[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2018-06-25 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Jakub Jelinek  ---
Fixed for 6.5 too.

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2018-06-25 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #12 from Jakub Jelinek  ---
Author: jakub
Date: Mon Jun 25 16:54:49 2018
New Revision: 262038

URL: https://gcc.gnu.org/viewcvs?rev=262038=gcc=rev
Log:
Backported from mainline
2017-11-24  Jakub Jelinek  

PR sanitizer/83014
* ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
instead of pp_printf with HOST_WIDE_INT_PRINT_DEC.  Avoid calling
tree_to_uhwi twice.

* gcc.dg/ubsan/pr83014.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/ubsan/pr83014.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/ubsan.c

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-12-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #11 from Jakub Jelinek  ---
Fixed for 7.3+ too.

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-12-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Fri Dec 15 21:58:13 2017
New Revision: 255715

URL: https://gcc.gnu.org/viewcvs?rev=255715=gcc=rev
Log:
Backported from mainline
2017-11-24  Jakub Jelinek  

PR sanitizer/83014
* ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
instead of pp_printf with HOST_WIDE_INT_PRINT_DEC.  Avoid calling
tree_to_uhwi twice.

* gcc.dg/ubsan/pr83014.c: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.dg/ubsan/pr83014.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/ubsan.c

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Fri Nov 24 08:35:10 2017
New Revision: 255134

URL: https://gcc.gnu.org/viewcvs?rev=255134=gcc=rev
Log:
PR sanitizer/83014
* ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
instead of pp_printf with HOST_WIDE_INT_PRINT_DEC.  Avoid calling
tree_to_uhwi twice.

* gcc.dg/ubsan/pr83014.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/ubsan/pr83014.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/ubsan.c

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

Jakub Jelinek  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek  ---
Created attachment 42695
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42695=edit
gcc8-pr83014.patch

Untested fix.  I believe this is because on mingw host HOST_LONG_LONG_FORMAT
is redefined to "I64", but that is a Microsoft-ism that pp_printf of course
doesn't handle.  pp_unsigned_wide_integer or pp_scalar it uses should handle
this fine by using the host sprintf into a temporary buffer and then just
appending the digit buffer.
As this needs mingw host, I can't really test whether it fixes this though, can
only bootstrap/regtest it on linux.

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-23 Thread ghjghj530-bubu at yahoo dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #7 from ghjghj530-bubu at yahoo dot de ---
I tried debugging the GCC today (not my strong side).
I ended up to extracte the call to cc1plus.exe and started GDB with cc1plus.exe
as target.
If i just run the process the ICE still occurs with the same information as
before: "internal compiler error: in pp_format, at pretty-print.c:630"

So i set a breakpoint at this location and printed the backtrace and some
variables:

Breakpoint 2, pp_format (pp=pp@entry=0xbd9fba8, text=text@entry=0xbd9faec) at
../../gcc-6.3.0/gcc/pretty-print.c:630
630 in ../../gcc-6.3.0/gcc/pretty-print.c
(gdb) bt
#0  pp_format (pp=pp@entry=0xbd9fba8, text=text@entry=0xbd9faec) at
../../gcc-6.3.0/gcc/pretty-print.c:630
#1  0x00f469ab in pp_printf (pp=pp@entry=0xbd9fba8, msg=msg@entry=0x116423d
 "%I64d")
at ../../gcc-6.3.0/gcc/pretty-print.c:874
#2  0x009219b9 in ubsan_type_descriptor (type=,
type@entry=0xda193c0, pstyle=pstyle@entry=UBSAN_PRINT_ARRAY)
at ../../gcc-6.3.0/gcc/ubsan.c:416
#3  0x0092213a in ubsan_expand_bounds_ifn (gsi=gsi@entry=0xbd9fc9c) at
../../gcc-6.3.0/gcc/ubsan.c:693
#4  0x00927438 in (anonymous namespace)::pass_sanopt::execute (this=, fun=0x14b068) at ../../gcc-6.3.0/gcc/sanopt.c:696
#5  0x0085c61a in execute_one_pass (pass=pass@entry=0x15d4e0) at
../../gcc-6.3.0/gcc/passes.c:2336
#6  0x0085cb78 in execute_pass_list_1 (pass=0x15d4e0, pass@entry=0x15a728) at
../../gcc-6.3.0/gcc/passes.c:2420
#7  0x0085cbd9 in execute_pass_list (fn=0x14b068, pass=0x15a728) at
../../gcc-6.3.0/gcc/passes.c:2431
#8  0x005f928f in cgraph_node::expand (this=0xda28000) at
../../gcc-6.3.0/gcc/cgraphunit.c:1982
#9  0x005f9e02 in output_in_order (no_reorder=no_reorder@entry=false) at
../../gcc-6.3.0/gcc/cgraphunit.c:2220
#10 0x005fa12c in symbol_table::compile (this=this@entry=0x14b000) at
../../gcc-6.3.0/gcc/cgraphunit.c:2468
#11 0x005fc097 in compile (this=0x14b000) at
../../gcc-6.3.0/gcc/cgraphunit.c:2538
#12 symbol_table::finalize_compilation_unit (this=0x14b000) at
../../gcc-6.3.0/gcc/cgraphunit.c:2564
#13 0x009085a5 in compile_file () at ../../gcc-6.3.0/gcc/toplev.c:488
#14 0x0109b23a in do_compile () at ../../gcc-6.3.0/gcc/toplev.c:1986
#15 toplev::main (this=this@entry=0xbd9ff1e, argc=argc@entry=14,
argv=argv@entry=0xc212ff0) at ../../gcc-6.3.0/gcc/toplev.c:2094
#16 0x010b2fb6 in main (argc=14, argv=0xc212ff0) at
../../gcc-6.3.0/gcc/main.c:39
(gdb) p pp->format_decoder
$11 = (printer_fn) 0x0
(gdb) p pp
$12 = (pretty_printer *) 0xbd9fba8
(gdb)


Continuing at this position leads to the ICE

Does this help in any way? How can i contribute more information?

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-16 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #6 from Martin Liška  ---
Sorry, but I can't reproduce on linux with cross compiler for mingw32.

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-16 Thread ghjghj530-bubu at yahoo dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #5 from ghjghj530-bubu at yahoo dot de ---
The OS is Windows 7, 64-bit.

Unfortunately i don't use the debug-version of GCC and can therefore not
provide a detailed backtrace right now. Maybe next week.

Note that my original message contains at least the error position "pp_format,
at pretty-print.c:630"

The problems also occurs with this version of GCC:

Target: mingw32
Configured with: ../src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu
--host=m
ingw32 --prefix=/mingw --disable-win32-registry --target=mingw32
--with-arch=i58
6 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static
--enable-sha
red --enable-threads --with-dwarf2 --disable-sjlj-exceptions
--enable-version-sp
ecific-runtime-libs --with-libintl-prefix=/mingw --enable-libstdcxx-debug
--with
-tune=generic --enable-libgomp --disable-libvtv --enable-nls : (reconfigured)
..
/src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32
--prefix=/mi
ngw --disable-win32-registry --target=mingw32 --with-arch=i586
--enable-language
s=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared
--enable-thread
s --with-dwarf2 --disable-sjlj-exceptions
--enable-version-specific-runtime-libs
 --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw
--enable-libstdcxx-d
ebug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 5.3.0 (GCC)

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-16 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #4 from Martin Liška  ---
And can you please run it in debugger in order to display back-trace?

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-16 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #3 from Martin Liška  ---
Ok, so it's i686 target. What operation system is that?

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-16 Thread ghjghj530-bubu at yahoo dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

--- Comment #2 from ghjghj530-bubu at yahoo dot de ---
Thanks for your quick response:

Compiling with --verbose:

Using built-in specs.
COLLECT_GCC=i686-elf-gcc.exe
Target: i686-elf
Configured with: ../gcc-6.3.0/configure --prefix=/opt/V6.3.0 --target=i686-elf
--with-pic --with-newlib --enable-languag
ray --disable-nls --disable-shared --disable-multilib --disable-threads
--disable-tls --disable-win32-registry --enable-
-pointer --disable-__cxa_atexit --disable-libgomp --disable-libquadmath
--disable-libssp --disable-libada --disable-libi
 --disable-libstdcxx-visibility --with-default-libstdcxx-abi=gcc4-compatible
--without-headers : (reconfigured) ../gcc-6
6.3.0 --target=i686-elf --with-pic --with-newlib --enable-languages=c,c++
--disable-initfini-array --disable-nls --disab
-disable-threads --disable-tls --disable-win32-registry
--enable-sjlj-exceptions --enable-frame-pointer --disable-__cxa_
able-libquadmath --disable-libssp --disable-libada --disable-libitm
--disable-libstdcxx-verbose --disable-libstdcxx-visi
x-abi=gcc4-compatible --with-headers
Thread model: single
gcc version 6.3.0 (GCC)
COLLECT_GCC_OPTIONS='-c' '-fsanitize=undefined' '-v' '-mtune=generic'
'-march=pentiumpro'
 C:/gnuinst/v6.3.0/bin/../libexec/gcc/i686-elf/6.3.0/cc1plus.exe -quiet -v
-iprefix c:
k\as\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/ c:\temp\test.cpp -quiet
-dumpbase test.cpp -mtune=generic -march=pent
-fsanitize=undefined -o C:\Users\grosst\AppData\Local\Temp\ccVWHL7C.s
GNU C++14 (GCC) version 6.3.0 (i686-elf)
compiled by GNU C version 5.3.0, GMP version 5.1.2, MPFR version 3.1.2,
MPC version 1.0.2, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/../../
ignoring duplicate directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0/.
+/6.3.0"
ignoring duplicate directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0/.
+/6.3.0/i686-elf"
ignoring duplicate directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0/.
+/6.3.0/backward"
ignoring duplicate directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0/i
ignoring duplicate directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0/i
ignoring nonexistent directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0
ude"
ignoring duplicate directory
"C:/gnuinst/v6.3.0/lib/gcc/../../lib/gcc/i686-elf/6.3.0/.
#include "..." search starts here:
#include <...> search starts here:

C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/../../../../i686-elf/include/c++/6.3.

C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/../../../../i686-elf/include/c++/6.3.

C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/../../../../i686-elf/include/c++/6.3.
 C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/include
 C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/include-fixed
 C:\gnuinst\v6.3.0\bin\../lib/gcc/i686-elf/6.3.0/../../../../i686-elf/include
End of search list.
GNU C++14 (GCC) version 6.3.0 (i686-elf)
compiled by GNU C version 5.3.0, GMP version 5.1.2, MPFR version 3.1.2,
MPC version 1.0.2, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b10cc2d805285f11263a2d3a4a7dce91
c:\temp\test.cpp: In function 'int setArrayElemment()':
c:\temp\test.cpp:1:5: internal compiler error: in pp_format, at
pretty-print.c:630
 int setArrayElemment()
 ^~~~

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

c:\temp\test.cpp:1:5: internal compiler error: Aborted

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
i686-elf-gcc.exe: internal compiler error: Aborted (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Compiling with -E:

# 1 "c:\\temp\\test.cpp"
# 1 ""
# 1 ""
# 1 "c:\\temp\\test.cpp"
int setArrayElemment()
{
 int data[5];
 data[5] = 0;
 return data[0];
}
int main()
{
}

[Bug sanitizer/83014] ICE in pretty-print with -fsanitize=bounds

2017-11-16 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83014

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-11-16
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Can't reproduce on linux. Can you please add '--verbose' flag?
Can you please attach output (pre-processed source filE) of -E?