[Bug c++/57044] New: The following code won't compile with -std=c++0x

2013-04-23 Thread pberuto at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57044



 Bug #: 57044

   Summary: The following code won't compile with -std=c++0x

Classification: Unclassified

   Product: gcc

   Version: 4.7.2

Status: UNCONFIRMED

  Severity: major

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: pber...@yahoo.com





The following code causes a GCC internal error Segmentation fault:



class myclass

{

public:

   templatetypename T_

   inline explicit myclass(T_ *s)

   {

  char buf[mylib::someclass::some_const]; // this line causes the fault

  // ... do something useful with buf

   }



   ...  

};



// somewhere else:

nemaspace mylib

{

   class someclass

   {

   public:

  static const uint32_t some_const;

   }

}



// other info:

all GCC versions from 4.5.3 and below compile that code fine. Not tested with

other gcc versions before 4.7.2.

compile flags are CXXFLAGS=-g -O0 -pipe -std=c++0x



Thank you.


[Bug c++/57044] The following code won't compile

2013-04-23 Thread pberuto at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57044



--- Comment #1 from Piergiorgio Beruto pberuto at yahoo dot com 2013-04-23 
10:36:46 UTC ---

Work Around is the following (add an intermediate const variable):



templatetypename T_

inline explicit myclass(T_ *s)

{

   const uint32_t sz = mylib::someclass::some_const;

   char buf[sz];



   // ... do something useful with buf

}


[Bug c++/57044] The following code won't compile

2013-04-23 Thread pberuto at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57044



--- Comment #3 from Piergiorgio Beruto pberuto at yahoo dot com 2013-04-23 
10:48:19 UTC ---

(In reply to comment #2)

 Please read http://gcc.gnu.org/bugs

 

 Is this really what you're compiling?

 nemaspace and ... should not be there and uint32_t is not declared.

 

 Please provide the *real* source you're compiling, as well as the output of

 'g++ -v'

 

 

 When I fix those obvious errors in your code I get a correct diagnostic with 
 no

 segfault from G++ 4.7.2

 

 c.cc: In constructor 'myclass::myclass(T_*)':

 c.cc:7:16: error: 'mylib' has not been declared



Ok sorry I'm new to GCC bugzilla, If you need real code I'll provide it.


[Bug c++/57044] The following code won't compile

2013-04-23 Thread pberuto at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57044



--- Comment #5 from Piergiorgio Beruto pberuto at yahoo dot com 2013-04-23 
17:04:01 UTC ---

Created attachment 29923

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29923

preprocessed source


[Bug c++/57044] The following code won't compile

2013-04-23 Thread pberuto at yahoo dot com

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57044

--- Comment #6 from Piergiorgio Beruto pberuto at yahoo dot com 2013-04-23 
17:06:46 UTC ---
Ok, my fault for missing the instructions.
However, I hope to have included everything you need now.

SYSTEM:
Linux sabayon 3.5.0-sabayon #1 SMP Tue Sep 11 08:32:37 UTC 2012 i686 Intel(R)
Core(TM) i7 CPU 950 @ 3.07GHz GenuineIntel GNU/Linux

COMMAND:
g++ -v -save-temps -DHAVE_CONFIG_H -I.
-I../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0
-I../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0/src   -std=c++0x
-I/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0/../../../../pem-1.0.0/ask_modules/pem_sal-1.0.0/src
-I/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0/../../../../pem-1.0.0/ask_modules/pem_sal-1.0.0/src/os/linux-gnu
-I/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0  
-I/home/karagul/projects/build/pem/ask_modules/pem_logger-1.0.0/../../../../pem-1.0.0/ask_modules/pem_logger-1.0.0/src
-I/home/karagul/projects/build/pem/ask_modules/pem_logger-1.0.0  
-D__PEM_LOGGER_PRINT_PRETTY_FUNCTION__ -g -O0 -Wall -Werror -pipe -DDEBUG  -MT
pem_iomond-pem_iomon_visitors.o -MD -MP -MF
.deps/pem_iomond-pem_iomon_visitors.Tpo -c -o pem_iomond-pem_iomon_visitors.o
`test -f 'src/pem_iomon_visitors.cc' || echo
'../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0/'`src/pem_iomon_visitors.cc

OUTPUT:
g++: warning: -pipe ignored because -save-temps specified
Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.7.2/g++
Target: i686-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.7.2-r1/work/gcc-4.7.2/configure --prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.7.2
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.7.2
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.7.2/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.7.2/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check
--with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --disable-multilib --enable-libmudflap
--disable-libssp --enable-esp --enable-libgomp
--with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.7.2/python
--enable-checking=release --enable-libstdcxx-time --with-arch=i686
--enable-objc-gc --enable-languages=c,c++,java,go,objc,obj-c++,fortran
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 4.7.2-r1 p1.5, pie-0.5.5'
Thread model: posix
gcc version 4.7.2 (Gentoo Hardened 4.7.2-r1 p1.5, pie-0.5.5) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-D' 'HAVE_CONFIG_H' '-I' '.' '-I'
'../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0' '-I'
'../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0/src' '-std=c++11' '-I'
'/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0/../../../../pem-1.0.0/ask_modules/pem_sal-1.0.0/src'
'-I'
'/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0/../../../../pem-1.0.0/ask_modules/pem_sal-1.0.0/src/os/linux-gnu'
'-I' '/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0' '-I'
'/home/karagul/projects/build/pem/ask_modules/pem_logger-1.0.0/../../../../pem-1.0.0/ask_modules/pem_logger-1.0.0/src'
'-I' '/home/karagul/projects/build/pem/ask_modules/pem_logger-1.0.0' '-D'
'__PEM_LOGGER_PRINT_PRETTY_FUNCTION__' '-g' '-O0' '-Wall' '-Werror' '-pipe'
'-D' 'DEBUG' '-MT' 'pem_iomond-pem_iomon_visitors.o' '-MD' '-MP' '-MF'
'.deps/pem_iomond-pem_iomon_visitors.Tpo' '-c' '-o'
'pem_iomond-pem_iomon_visitors.o' '-shared-libgcc' '-mtune=generic'
'-march=i686' '-fPIE' '-pie'
 /usr/libexec/gcc/i686-pc-linux-gnu/4.7.2/cc1plus -E -quiet -v -I . -I
../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0 -I
../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0/src -I
/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0/../../../../pem-1.0.0/ask_modules/pem_sal-1.0.0/src
-I
/home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0/../../../../pem-1.0.0/ask_modules/pem_sal-1.0.0/src/os/linux-gnu
-I /home/karagul/projects/build/pem/ask_modules/pem_sal-1.0.0 -I
/home/karagul/projects/build/pem/ask_modules/pem_logger-1.0.0/../../../../pem-1.0.0/ask_modules/pem_logger-1.0.0/src
-I /home/karagul/projects/build/pem/ask_modules/pem_logger-1.0.0 -MD
pem_iomond-pem_iomon_visitors.d -MF .deps/pem_iomond-pem_iomon_visitors.Tpo -MP
-MT pem_iomond-pem_iomon_visitors.o -D_GNU_SOURCE -D HAVE_CONFIG_H -D
__PEM_LOGGER_PRINT_PRETTY_FUNCTION__ -D DEBUG
../../../../pem-1.0.0/ask_modules/pem_pmon-1.0.0/src/pem_iomon_visitors.cc
-fno-strict-overflow -mtune=generic -march=i686 -std=c++11 -Wall -Werror -fPIE
-g -fworking-directory -O0 -fpch-preprocess -fstack-protector-all -o
pem_iomon_visitors.ii
ignoring

[Bug c++/57044] The following code won't compile

2013-04-23 Thread pberuto at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57044



--- Comment #7 from Piergiorgio Beruto pberuto at yahoo dot com 2013-04-23 
17:08:17 UTC ---

Sorry for posting an archive, but the size of the .ii file was too big for

being submitted to bugzilla.