public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/10252: __builtin_constant_p() returns TRUE for non-constant expression
@ 2003-03-28  7:36 davidm
  0 siblings, 0 replies; 3+ messages in thread
From: davidm @ 2003-03-28  7:36 UTC (permalink / raw)
  To: gcc-gnats; +Cc: rth


>Number:         10252
>Category:       optimization
>Synopsis:       __builtin_constant_p() returns TRUE for non-constant expression
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 28 07:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     David Mosberger
>Release:        gcc version 3.4 20030327 (experimental)
>Organization:
>Environment:
IA-64 Linux
>Description:
The attached test-program demonstrates a case where GCC
thinks a non-constant expression is constant.  When compiled
with -O2, the resulting object file will have an undefined
reference to __bad_stuff().  The problem doesn't show with
lower optimization levels.

>How-To-Repeat:
gcc -Wall -c -O2 sem.i
nm sem.o |grep bad
                 U __bad_stuff
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="sem.i"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="sem.i"

c3RydWN0IHNlbWEgewoJaW50IHNsZWVwZXJzOwp9OwoKdm9pZApmb28gKHN0cnVjdCBzZW1hICog
c2VtKQp7CglleHRlcm4gdm9pZCBfX2JhZF9zdHVmZiAodm9pZCk7CgogICAgICAgIGZvciAoOzsp
IHsKICAgICAgICAgICAgICAgIGlmIChzZW0pIHsKCQkJaWYgKF9fYnVpbHRpbl9jb25zdGFudF9w
KHNlbS0+c2xlZXBlcnMpKQoJCQkJX19iYWRfc3R1ZmYoKTsKICAgICAgICAgICAgICAgICAgICAg
ICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgfQp9Cg==


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: optimization/10252: __builtin_constant_p() returns TRUE for non-constant expression
@ 2003-03-31  1:16 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2003-03-31  1:16 UTC (permalink / raw)
  To: davidm, gcc-bugs, gcc-prs, nobody, rth

Synopsis: __builtin_constant_p() returns TRUE for non-constant expression

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Sun Mar 30 23:22:40 2003
Responsible-Changed-Why:
    .
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Sun Mar 30 23:22:40 2003
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02497.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10252


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: optimization/10252: __builtin_constant_p() returns TRUE for non-constant expression
@ 2003-03-28  8:46 Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2003-03-28  8:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/10252; it has been noted by GNATS.

From: Alan Modra <amodra@bigpond.net.au>
To: davidm@hpl.hp.com
Cc: gcc-gnats@gcc.gnu.org, rth@redhat.com
Subject: Re: optimization/10252: __builtin_constant_p() returns TRUE for non-constant expression
Date: Fri, 28 Mar 2003 19:02:05 +1030

 Same thing happens on powerpc64-linux.  __bad_stuff will never be
 executed, so looks like dead code elimination isn't working properly.
 
   14:   38 00 00 00     li      r0,0
   18:   2f 80 00 00     cmpwi   cr7,r0,0
   1c:   40 9e 00 14     bne-    cr7,30 <.foo+0x30>
 [snip]
   30:   48 00 00 01     bl      30 <.foo+0x30>
                         30: R_PPC64_REL24       .__bad_stuff
 -- 
 Alan Modra
 IBM OzLabs - Linux Technology Centre


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-30 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-28  7:36 optimization/10252: __builtin_constant_p() returns TRUE for non-constant expression davidm
2003-03-28  8:46 Alan Modra
2003-03-31  1:16 rth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).