This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Invalid code crashes gcc and worse, compiles


Hi,

the following code is invalid but it crashes gcc (NB should be defined
and const)
But the worst is: it compiles if I don't include <string>.

************

#ifndef __PIPO_H__
#define __PIPO_H__

#include <string>

class Pipo
{
private: 
  static int NB;
  
  int tab[NB];
  int tab2[NB];
};

int main(int argc, char ** argv) {
  Pipo pipo;
  return 0;
}
#endif // __PIPO_H__

************

$ /usr/bin/g++ -c -g -Wall -Wstrict-prototypes -ansi  Pipo.cpp
Pipo.cpp: In function `int main(int, char **)':
Pipo.cpp:16: warning: unused variable `class Pipo pipo'
Pipo.cpp:18: Internal compiler error.
Pipo.cpp:18: Please submit a full bug report.
Pipo.cpp:18: See <URL:http://www.gnu.org/software/gcc/bugs.html> for
instructions.

Without tab2 line

$ /usr/bin/g++ -c -g -Wall -Wstrict-prototypes -ansi  Pipo.cpp
Pipo.cpp: In function `int main(int, char **)':
Pipo.cpp:15: warning: unused variable `class Pipo pipo'
Pipo.cpp:17: internal error--insn does not satisfy its constraints:
(insn 53 11 12 (set (reg:SI 2 %ecx)
        (reg:SI 23)) 48 {movsi+2} (nil)
    (nil))


Without <string> line

$ /usr/bin/g++ -c -g -Wall -Wstrict-prototypes -ansi  Pipo.cpp
Pipo.cpp: In function `int main(int, char **)':
Pipo.cpp:16: warning: unused variable `class Pipo pipo'


Hope this helps

Regards,

--
Benoît Sibaud
R&D Engineer R&D France Telecom

Pipo.ii.bz2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]