[Bug rtl-optimization/24812] New: Optimizer creates infinite loop with -fno-strict-aliasing

2005-11-11 Thread cnewbold at mathworks dot com
The following test program goes into an infinite loop when compiled with -O2
and -fno-strict-aliasing but works correctly if -fno-strict-aliasing is
omitted.

$ g++-3.4 -g -O2 -fno-strict-aliasing -o loop loop.C

// loop.C
class DummyType
{
public:
~DummyType() { }
};

class Foo
{
public:
Foo() : X0(0), X4(0) { }
int X0, X1, X2, X3, X4;
};

int main(int, char**)
{
{
Foo f;
DummyType d;
}

Foo f2;

bool done(false);

while (!done) {
if (f2.X4 != 0) f2.X4 = 0;
else done = true;;
}

return 0;
}

-

Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)


-- 
   Summary: Optimizer creates infinite loop with -fno-strict-
aliasing
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cnewbold at mathworks dot com


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



[Bug c++/24368] New: -Wshadow gets confused by built-ins

2005-10-14 Thread cnewbold at mathworks dot com
Consider the following example:

#include 
// Okay if we do this:
//using std::floor;
double f(double d)
{
// If we do this, however, GCC says: "shadow.C:7: warning:
// shadowing built-in function `double std::floor(double)'"
using std::floor;
return floor(d);
}

As indicated in the comments, the example compiles without warnings when using
-Wshadow IFF 'using std::floor' is at file scope. However, if the using
declaration is moved inside of a function, GCC complains about shadowing a
built-in.

---

[EMAIL PROTECTED]:~/playpen$ g++-3.4 -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)


-- 
   Summary: -Wshadow gets confused by built-ins
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cnewbold at mathworks dot com


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



[Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697

2005-08-29 Thread cnewbold at mathworks dot com
Attempting to compile the following example (with no explicit command-line
arguments) results in an ICE:

---

typedef unsigned char RESET_OCCUR_DT;

typedef struct {
RESET_OCCUR_DT*pResetOccur;
} DintgRec;

template
void f()
{
int i, resetScalar;
DintgRec* s;

if (s->pResetOccur[resetScalar ? 0 : i] != 0U) {
}
}


void g()
{
f();
}

--

Here's the exact compiler output:

ice.C: In function `void f()':
ice.C:13: internal compiler error: in invert_truthvalue, at fold-const.c:2697
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.
[EMAIL PROTECTED]:~/playpen$

-

And here's the output of '-v' on the compiler in question:

Reading specs from
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: /home/cnewbold/src/gnu/gcc-3.4.4/configure
--enable-__cxa_atexit --prefix=/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4
Thread model: posix
gcc version 3.4.4

-- 
   Summary: ICE: internal compiler error: in invert_truthvalue, at
fold-const.c:2697
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: cnewbold at mathworks dot com
CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


[Bug rtl-optimization/22129] [3.4 only] Optimization stomps const, initialized local array

2005-06-21 Thread cnewbold at mathworks dot com

--- Additional Comments From cnewbold at mathworks dot com  2005-06-21 
15:50 ---
Subject: Re:  [3.4 only] Optimization stomps
const, initialized local array

On Mon, 2005-06-20 at 20:48 +, pinskia at gcc dot gnu dot org wrote:

> Also note this is not a full testcase and cannot just run, so is there way to 
> get one which is self 
> contained?

I have not had any success limiting the scope of the source required for
an executable example. The code in question comes from the
self-validation code for the open-source Crypto++ library, a C++ class
library of cryptographic primitives, version 4.2. Let me know what would
be most useful for you at this point.

One additional note, it appears that removing "-fno-strict-aliasing"
from the compiler command line also makes the problem go away even with
-O2 or -O3. I doubt this is safe, however.

-Chris



-- 


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


[Bug rtl-optimization/22129] [3.4 only] Optimization stomps const, initialized local array

2005-06-20 Thread cnewbold at mathworks dot com

--- Additional Comments From cnewbold at mathworks dot com  2005-06-20 
20:51 ---
Subject: Re:  [3.4 only] Optimization stomps
const, initialized local array

On Mon, 2005-06-20 at 20:48 +, pinskia at gcc dot gnu dot org wrote:

> Also note this is not a full testcase and cannot just run, so is there way to 
> get one which is self 
> contained?

Sorry, I thought just being able to inspect the assembler would be
enough for you. A full, executable test case consists of 10+ source
files. I'll see what I can do about paring it down.

-Chris



-- 


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


[Bug rtl-optimization/22129] Optimization stomps const, initialized local array

2005-06-20 Thread cnewbold at mathworks dot com

--- Additional Comments From cnewbold at mathworks dot com  2005-06-20 
20:46 ---
Subject: Re:  Optimization stomps const,
initialized local array

On Mon, 2005-06-20 at 20:39 +, pinskia at gcc dot gnu dot org wrote:

> I don't see the problem on the mainline, maybe I not understanding what you 
> mean.

The problem is that once we're past the initialization and into the body
of the block, the array does not have the correct content. In the
example I cited, the first byte of 'encrypted' does not contain 0xf3,
but instead some random trash. Here's a break down of the assembler for
the opening of that block:

First byte of 'encrypted' (correctly) loaded with 0xf3:
2cab:   c6 85 08 ff ff ff f3movb   $0xf3,0xff08(%ebp)

Something else dropped in here, which stomps the first element:
2cb2:   ba 08 00 00 00  mov$0x8,%edx
2cb7:   b9 08 00 00 00  mov$0x8,%ecx
2cbc:   89 95 08 ff ff ff   mov%edx,0xff08(%ebp)
   
  OOOPS!
2cc2:   31 c0   xor%eax,%eax
2cc4:   8d 55 b8lea0xffb8(%ebp),%edx
2cc7:   89 8d 28 ff ff ff   mov%ecx,0xff28(%ebp)
2ccd:   8d 8d 30 ff ff ff   lea0xff30(%ebp),%ecx

Remaining 23 bytes of 'encrypted' are loaded:
2cd3:   c6 85 09 ff ff ff 09movb   $0x9,0xff09(%ebp)
2cda:   c6 85 0a ff ff ff 62movb   $0x62,0xff0a(%ebp)
...

-Chris


-- 


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


[Bug c++/22129] Optimization stomps const, initialized local array

2005-06-20 Thread cnewbold at mathworks dot com

--- Additional Comments From cnewbold at mathworks dot com  2005-06-20 
20:36 ---
I should add that this initialization problem also occurs for one other local
arrays in the example in addition to the one already noted: the array 
"plain" on line 611.

The problem still manifests at -O2 instead of -O3, but goes away at -O1.

-- 


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


[Bug c++/22129] Optimization stomps const, initialized local array

2005-06-20 Thread cnewbold at mathworks dot com

--- Additional Comments From cnewbold at mathworks dot com  2005-06-20 
20:26 ---
Created an attachment (id=9119)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9119&action=view)
pre-processed source which illustrates the bug


-- 


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


[Bug c++/22129] New: Optimization stomps const, initialized local array

2005-06-20 Thread cnewbold at mathworks dot com
-linux-gnu/3.4.4/../../../../include/c++/3.4.4/backward"
ignoring duplicate directory
"/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/lib/gcc/i686-pc-linux-gnu/3.4.4/include"
ignoring nonexistent directory
"/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory "../include"
ignoring nonexistent directory "../../include"
#include "..." search starts here:
#include <...> search starts here:
 .
 
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4
 
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/i686-pc-linux-gnu
 
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/backward
 
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/include
 /usr/local/include
 /hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/include
 /usr/include
End of search list.
 
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../libexec/gcc/i686-pc-linux-gnu/3.4.4/cc1plus
-fpreprocessed validat1.ii -quiet -dumpbase validat1.cpp -mtune=pentiumpro -ansi
-auxbase-strip /tmp/validat1.o -g -gstabs+ -O3 -Wno-parentheses -Wcast-align
-Wno-deprecated -Werror -ansi -version -fno-strict-aliasing -fexceptions -o
validat1.s
GNU C++ version 3.4.4 (i686-pc-linux-gnu)
compiled by GNU C version 3.4.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../i686-pc-linux-gnu/bin/as
-V -Qy -o /tmp/validat1.o validat1.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15

-- 
   Summary: Optimization stomps const, initialized local array
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: normal
          Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cnewbold at mathworks dot com
CC: gcc-bugs at gcc dot gnu dot org


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