[Bug libstdc++/81584] New: Pretty Printer for string* doesn't work

2017-07-27 Thread ghjghj530-bubu at yahoo dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81584

Bug ID: 81584
   Summary: Pretty Printer for string* doesn't work
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ghjghj530-bubu at yahoo dot de
  Target Milestone: ---

GCC 6.3, GDB 7.10, building with: -D_GLIBCXX_USE_CXX11_ABI=1

Code:
std::string fooVar = "hello world";
std::string* pFooVar = 

(gdb) p pFooVar
p pFooVar
$4 = Traceback (most recent call last):
  File "*\gdb-7.10/python\libstdcxx\v6\printers.py", line xx, in to_string
reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
gdb.error: No type named std::__cxx11::string *::_Rep.


I changed the python script to this and it worked for me:

def __init__(self, typename, val):
self.val = val

def to_string(self):
# Make sure  and string* works, too.
type = self.val.type
if type.code == gdb.TYPE_CODE_REF or type.code == gdb.TYPE_CODE_PTR:
type = type.target ()

# Change to original printer to make string* work: Check for new/old
string after dereferencing
typeName = str(type)
new_string = typeName.find("::__cxx11::basic_string") != -1 or
typeName.find("::__cxx11::string") != -1

# Calculate the length of the string so that to_string returns the
string according to length, 
# not according to first null encountered.
ptr = self.val ['_M_dataplus']['_M_p']
if new_string:
..
..

[Bug libstdc++/83127] New: Missing overload for operator << of std::stringstream for old ABI

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

Bug ID: 83127
   Summary: Missing overload for operator << of std::stringstream
for old ABI
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ghjghj530-bubu at yahoo dot de
  Target Milestone: ---

Compiling the following testcode

#include 
#include 

void Main(void)
{
std::string testStr("Hello");
std::string testStr2("World");
std::stringstream ss;

ss << testStr;

testStr2 = ss.str();
}

with flag: -D_GLIBCXX_USE_CXX11_ABI=0 leads to linker error:
undefined reference to `std::basic_ostream<char, std::char_traits >&
std::operator<< <char, std::char_traits, std::allocator
>(std::basic_ostream<char, std::char_traits >&, std::basic_string<char,
std::char_traits, std::allocator > const&)'

Setting -D_GLIBCXX_USE_CXX11_ABI=1 fixes the bug.

We narrowed the problem down to a missing overload in libstdc++.a using:
nm.exe -gC "libstdc++.a" > libstdc++.a.out

There is only one overload for operator << and string:
"std::__cxx11::basic_string"
 W std::basic_ostream<char, std::char_traits >& std::operator<<
<char, std::char_traits, std::allocator >(std::basic_ostream<char,
std::char_traits >&, std::__cxx11::basic_string<char,
std::char_traits, std::allocator > const&)

But two overloads for operator >>:
"std::__cxx11::basic_string" and "std::basic_string"
 W std::basic_istream<wchar_t, std::char_traits >&
std::operator>><wchar_t, std::char_traits, std::allocator
>(std::basic_istream<wchar_t, std::char_traits >&,
std::__cxx11::basic_string<wchar_t, std::char_traits,
std::allocator >&)
 W std::basic_istream<wchar_t, std::char_traits >&
std::operator>><wchar_t, std::char_traits, std::allocator
>(std::basic_istream<wchar_t, std::char_traits >&,
std::basic_string<wchar_t, std::char_traits, std::allocator
>&)

[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
<tsan_atomic_table+3037> "%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 libstdc++/83127] Missing overload for operator << of std::stringstream for old ABI

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

--- Comment #3 from ghjghj530-bubu at yahoo dot de ---
Changed my testcode to int main(). The error stil occurs.
The system is Windows 7, 64 bit, mingw.

Is use the GCC in a company-specific enviroment with some customized
linkersripts.

We first compile the source file with:
i686-elf-gcc.exe -c C:\temp\2\Main.cpp -o c:\temp\2\Main.cpp.o
-D_GLIBCXX_USE_CXX11_ABI=0

and then call the linker:
i686-elf-gcc.exe C:\Temp\2\Main.cpp.o -o C:\Temp\2\a.out
-Wl,-lstdc++,-lsupc++,-lm -lc 
(i have removed a -specs paramter and some target plattform specific
parameters).

I'm sorry for the incomplete command line.

I still hope the *.a-File analysis from my original post can help you.

[Bug sanitizer/83014] New: 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

Bug ID: 83014
   Summary: ICE in pretty-print with -fsanitize=bounds
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ghjghj530-bubu at yahoo dot de
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Compiling the following testcode leads to an internal compiler error

int setArrayElemment()
{
int data[5];
data[5] = 0;
return data[0];
}
int main()
{
}

Compile with GCC 6.3 or 5.3
gcc.exe C:\temp\test.cpp -c -fsanitize=bounds
or
gcc.exe C:\temp\test.cpp -c -fsanitize=undefined

Leads to:

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.

[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 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 <http://gcc.gnu.org/bugs.html> 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 libstdc++/81584] Pretty Printer for string* doesn't work

2018-01-09 Thread ghjghj530-bubu at yahoo dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81584

--- Comment #2 from ghjghj530-bubu at yahoo dot de ---
You are right. The original script from GCC 6.3.0 contains a check for new/old
string implementation in the "init" function.

This bugreport can be closed. Sorry for the inconvenience.