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]

Re: BUG REPORT: internal compiler error


Hello there,

I just got a message that I should send a bug report.  I'm
running linux (Redhat 5.2), kernel 2.2.9 on i386 (AMD K6),
gcc version:

2.7.2.3  (Output of gcc -v)
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)  (Output of g++ -v)

Used command line:
   g++ test1.cc -o test1   
to compile.

The only difference between the two examples is that one
uses "dumm" as a placeholder and one "dum".  It appears
that at least a four character string is necessary or things won't
work.

The following code compiles and runs:


#include <iostream>

int main()
{

  char *myStr = "thisStringIsSeveralCharsLong";

  int  myStrLen = strlen( myStr ) + 1;
  
  char testCharArr[][ myStrLen ]    = { "dumm", "otherstring", "yetanother" };

  strcpy ( testCharArr[0], myStr );

  cout << "testCharArr[0] = " << testCharArr[0] << "\n";
 
}



The following code results in an error:

#include <iostream>

int main()
{

  char *myStr = "thisStringIsSeveralCharsLong";

  int  myStrLen = strlen( myStr ) + 1;
  
  char testCharArr[][ myStrLen ]    = { "dum", "otherstring", "yetanother" };

  strcpy ( testCharArr[0], myStr );

  cout << "testCharArr[0] = " << testCharArr[0] << "\n";
 
}


-- 
Steve Madsen, Computer Graphics Department
H2 Eye, Ltd.
24-28 Hatton Wall
London  EC1N 8JH
United Kingdom
Tel:   +44 (0) 171 404 9600
Fax:   +44 (0) 171 404 9490
Email: steve@h2eye.com



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