[Bug c/42049] New: ICE with -O2 - internal compiler error: in expand_expr_real_1, at expr.c:9314

2009-11-15 Thread richardn26 at gmail dot com
/* Following code give ICE with -O2 or -O3

ice.c: In function ‘main’:
ice.c:46: internal compiler error: in expand_expr_real_1, at expr.c:9314

   works OK with -O1 and no warnings given

*/

extern char *strcpy(char *s1, const char *s2);
/* #include  */

typedef struct _ccy_nameCCY_NAME;

#define CURRENCY_NAME_LENGTH3

struct _ccy_name {
char CcyName[CURRENCY_NAME_LENGTH + 1];
};

int main(int argc, char *argv[])
{
char const *ccy1;
char const *ccy2;
CCY_NAME ccy_list[9];
long i;

if (argc > 1)
{
ccy1 = argv[1];
}
else
{
ccy1 = "EUR";
}
if (argc > 2)
{
ccy2 = argv[2];
}
else
{
ccy2 = "USD";
}

strcpy(ccy_list[0].CcyName, ccy1);
strcpy(ccy_list[1].CcyName, ccy2);
for(i = 2; i < argc - 2 && i < 8; i++)
{
strcpy(ccy_list[i].CcyName, argv[i + 1]);
}
ccy_list[i].CcyName[0] = '\0';

return 0;
}

/*

$ gcc-4.4 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.1-4'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-objc-gc
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.1 (Debian 4.4.1-4) 

*/


-- 
   Summary: ICE with -O2 - internal compiler error: in
expand_expr_real_1, at expr.c:9314
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: richardn26 at gmail dot com


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



[Bug lto/51744] New: Erroneous warning: memset used with constant zero length parameter

2012-01-03 Thread richardn26 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51744

 Bug #: 51744
   Summary: Erroneous warning: memset used with constant zero
length parameter
Classification: Unclassified
   Product: gcc
   Version: 4.6.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: richard...@gmail.com


Created attachment 26233
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26233
concatated ma2.i and ma2_test.i from -save-temps ma2.c and ma2_test.c

Attached code gives erroneous warning when compiled with -
gcc -O3 -flto -Wall -Wextra -D_FORTIFY_SOURCE=2 -c ma2.c
gcc -O3 -flto -Wall -Wextra -D_FORTIFY_SOURCE=2 -c ma2_test.c
gcc -O3 -flto -Wall -Wextra -D_FORTIFY_SOURCE=2 -o ma2_test ma2_test.o ma2.o
ma2.o (symbol from plugin): warning: memset used with constant zero length
parameter; this could be due to transposed parameters

Compiling without -flto or without -D_FORTIFY_SOURCE=2 does not give warning.
Generated code seems to work ok anyway.