Re: static const int optimization fails in conditional expressions

2001-12-12 Thread Phil Edwards
Please stop cc'ing [EMAIL PROTECTED], by the way. That only works for appending to an existing PR, and there is no PR to append to. So their GNATS database pukes. On Tue, Dec 11, 2001 at 11:18:45PM -0600, James E Jurach Jr. wrote: > > Compilers are allowed to optimize static const integral m

Re: static const int optimization fails in conditional expressions

2001-12-12 Thread Martin v. Loewis
> Right. I'm reporting that > > 1) gcc's behavior changed in this regard in 2.96 and 3.00 from 2.95 and >previous, and Why is that a problem? The compiler does not need to be consistent. > 2) gcc sometimes uses these values directly without defining the variables, >while other times gc

Re: static const int optimization fails in conditional expressions

2001-12-11 Thread James E Jurach Jr.
> Compilers are allowed to optimize static const integral members, in the > sense that their values may be used directly. Right. I'm reporting that 1) gcc's behavior changed in this regard in 2.96 and 3.00 from 2.95 and previous, and 2) gcc sometimes uses these values directly without defini

Re: static const int optimization fails in conditional expressions

2001-12-11 Thread Phil Edwards
On Tue, Dec 11, 2001 at 08:45:40PM -0600, James E Jurach Jr. wrote: > I understood from nm(1) output that, at least in the past, g++ did not > create a symbol for these int's, but rather performed some kind of inline > optimization. Compilers are allowed to optimize static const integral members,

Re: static const int optimization fails in conditional expressions

2001-12-11 Thread James E Jurach Jr.
> On Tue, Dec 11, 2001 at 05:06:31PM -0600, James Jurach wrote: > > When class members declared as static const int appear in conditional > > expressions, they are not properly optimized out. The compiler treats them > > as undefined variables, rather than integer literals. > > That's because they

Re: static const int optimization fails in conditional expressions

2001-12-11 Thread Phil Edwards
On Tue, Dec 11, 2001 at 05:06:31PM -0600, James Jurach wrote: > When class members declared as static const int appear in conditional > expressions, they are not properly optimized out. The compiler treats them > as undefined variables, rather than integer literals. That's because they /are/ unde

static const int optimization fails in conditional expressions

2001-12-11 Thread James Jurach
>Submitter-Id: net >Originator:James Jurach >Organization: FundsXpress >Confidential: no >Synopsis: static const int optimization fails in conditional expressions >Severity: serious >Priority: medium >Category: c++ >Class: sw-bug >