[Bug c/14487] New: Cannot take address of register variable.

kuba at parasoft dot com dot pl gcc-bugzilla@gcc.gnu.org
Mon Mar 8 18:41:00 GMT 2004


/* Source file: */
 
register char *stack_ptr __asm__("sp");
 
char** foo()
{
    return &stack_ptr;
}
 
/* end */

kuba@gollum:~/src/reg$ gcc-3.4 t2.c
t2.c: In function `foo':
t2.c:6: warning: address of register variable `stack_ptr' requested
t2.c:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

I've checked it on Debian Unstable (i386), with compiler version:

Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040306)

I've check it also with: 
 3.2.3 (Debian), 
 3.4.0 (20040222 prerelease Debian),
 3.1 and
 2.95.3
with the same results. It seems to work with g++ 3.1 and gcc 2.95.4 
(debian) :)


I've left all *triplet fields blank bacause it have no idea what 
should I put there.

-- 
           Summary: Cannot take address of register variable.
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kuba at parasoft dot com dot pl
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list