public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25954]  New: external variable address assumed not to be zero
@ 2006-01-25  6:16 frederic dot petrot at lip6 dot fr
  2006-01-25 10:46 ` [Bug c/25954] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: frederic dot petrot at lip6 dot fr @ 2006-01-25  6:16 UTC (permalink / raw)
  To: gcc-bugs

Tested on gcc 4.0.2 20050808 and gcc 4.0.3 20051013 

I don't know if this is a bug or a feature : this code, also
compiled without optimization, doesn't check if the address of
the variable is zero.

extern unsigned long int __spm_addr;
int main(void)
{
     return &__spm_addr ? __spm_addr + 1 : -1;
}

gcc 3.x checks the variable address.


-- 
           Summary: external variable address assumed not to be zero
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: frederic dot petrot at lip6 dot fr


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


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

* [Bug c/25954] external variable address assumed not to be zero
  2006-01-25  6:16 [Bug c/25954] New: external variable address assumed not to be zero frederic dot petrot at lip6 dot fr
@ 2006-01-25 10:46 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-25 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-01-25 10:46 -------
The address of the variable cannot be zero.  If you want to play some dynamic
loading trick you have to mark the symbol weak.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2006-01-25 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-25  6:16 [Bug c/25954] New: external variable address assumed not to be zero frederic dot petrot at lip6 dot fr
2006-01-25 10:46 ` [Bug c/25954] " rguenth at gcc dot gnu dot org

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).