[Bug c++/20119] New: reading other stack variable memory space for shorts

2005-02-21 Thread dirkjan at magma-da dot com
the following command
g++ -g -S -dA -fno-strict-aliasing test_enum_cast2.cxx

produces 
   # test_enum_cast2.cxx:13
.loc 1 13 0
movl-12(%ebp), %eax
incl%eax
movw%ax, -2(%ebp)

which shows a movl for a short variable.

This is interpreted as possibly uninitialized memory read by purify (depending
on other stack variables and if they are initialized). Rational/IBM tells me
they do report the actual behaviour. Is there a way to avoid this movl and use
really word size? (I expect this to be an optimization but it hurds in this 
case)

the example is:
test_enum_cast2.cxx:
struct KEY{
  const char *name; //if removed this line then no error in purify (as it then 
reads
from initialized variable var set to 1 from the stack
  short type;
 };


int main(){
 short var=1; //if this is left uninit and key.type is set to 1 directly then no
erro
r in purify
 KEY key;
  key.name=0;
  key.type=var;

   var = key.type + 1;

 }

Thanks Dirk-Jan

-- 
   Summary: reading other stack variable memory space for shorts
   Product: gcc
   Version: 3.2.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dirkjan at magma-da dot com
CC: gcc-bugs at gcc dot gnu dot org


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


[Bug c++/20119] reading other stack variable memory space for shorts

2005-02-21 Thread dirkjan at magma-da dot com

--- Additional Comments From dirkjan at magma-da dot com  2005-02-21 10:57 
---
Subject: Re:  reading other stack variable memory space for
 shorts

Any chance to do something about it on older versions? (3.2.x 3.3.x 
3.4.x) I cannot compile with 4.0.0 for a while I am afraid. Compiler 
upgrades already cost some extensive testing to find the gcc bugs we run 
into. Doing a not released 4 upgrade and later again higher is not feasable.

Thanks,
Dirk-Jan



> Fixed in 4.0.0, not a regression.
> 


-- 


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


[Bug c++/20119] reading other stack variable memory space for shorts

2005-02-21 Thread dirkjan at magma-da dot com

--- Additional Comments From dirkjan at magma-da dot com  2005-02-21 12:04 
---
Subject: Re:  reading other stack variable memory space for
 shorts

Well there is no 4.0.0 released and even it it was it will take a while 
before the code base of us does compile and we found the gcc bugs we run 
into this time.

I understand your point, I was just wondering if there is any way for me 
to work around this issue now by setting any compile flag or so. Or even 
put a patch in our own gcc being used.

Dirk-Jan

falk at debian dot org wrote:
> --- Additional Comments From falk at debian dot org  2005-02-21 11:19 
> ---
> (In reply to comment #2)
> 
> 
>>Any chance to do something about it on older versions? (3.2.x 3.3.x 
>>3.4.x)
> 
> 
> No. We fix only regressions or very serious bugs in those versions.
> 
> 


-- 


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