https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63541

            Bug ID: 63541
           Summary: gcc compilation error: The register specified for
                    'variable' is not general enough to be used as a
                    register variable
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vinitha_kv at rediffmail dot com

For the following code gcc throws error and do not compile (for arm-*-gnueabi*)
Test code:
$ cat test.c
void foo()
{
 register unsigned int curr_pc asm ("pc");
 unsigned int arm_pc;
 arm_pc = curr_pc;
}
Observed the issue with gcc-4.8.0 onwards.(Works fine with 4.7.2)
Checked with latest with gcc 5.0 (GNU C (GCC) version 5.0.0 20141014 ) also,
getting the following error.
...
xgcc -v
Using built-in specs.
COLLECT_GCC=~/gcc-git/official-gcc/objdir/gcc/xgcc
Target: arm-none-linux-gnueabi
Configured with: ../configure --host=x86_64-pc-linux-gnu
--target=arm-none-linux-gnueabi --build=x86_64-pc-linux-gnu
--prefix=/usr/local/arm-none-linux-gnueabi/cross --disable-nls
--enable-__cxa_atexit --enable-languages=c,c++ --disable-multilib
--enable-threads=posix --enable-shared --enable-symvers=gnu
Thread model: posix
gcc version 5.0.0 20141014 (experimental) (GCC)


...
test.c: In function 'foo':
test.c:3:24: error: the register specified for 'curr_pc' is not general enough
to be used as a register variable
  register unsigned int curr_pc asm ("pc");
...

Digged a little and the error seems to occur after commit,
[https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bffbb863ff0f267b5111bfa95b42c99cd0474424]
in 4.8.0.

Regards,
Vinitha Vijayan

Reply via email to