middle-end/3919: __builtin_constant_p false on long long compile-time-known variable converted to long on 32-bit platform
lkb@users.sourceforge.net
lkb@users.sourceforge.net
Thu Aug 2 19:46:00 GMT 2001
>Number: 3919
>Category: middle-end
>Synopsis: __builtin_constant_p false on long long compile-time-known variable converted to long on 32-bit platform
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Thu Aug 02 19:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Luca Barbieri
>Release: 3.0
>Organization:
>Environment:
i686-pc-cygwin CYGWIN_NT-5.0 1.3.2(0.39/3/2) i686 unknown
>Description:
__builtin_constant_p returns false when it's called on a global long long variable, known to be constant (__builtin_constant_p returns true on it without typecasts), typecasted to long (probably happens for all 32-bit platforms, but only tested on i386).
This bug isn't present for local variables.
This bug is present at any optimization level.
>How-To-Repeat:
// Compile this (as either C or C++) and check the return value from the shell
// Returns: 2
// Should return: 3
long long var;
int main(int argc, char** argv)
{
var = 0;
return (__builtin_constant_p(var) ? 2 : 0)
| (__builtin_constant_p((long)var) ? 1 : 0);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list