This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67064] New: Register asm variable broken


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

            Bug ID: 67064
           Summary: Register asm variable broken
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sebastian.huber@embedded-brains.de
  Target Milestone: ---

The following test case fails on x86_64-pc-linux-gnu, powerpc-rtems,
sparc-rtems:

struct s {
  int i;
};

register struct s *reg __asm__( "1" );

int f(void)
{
  int i;

  i = reg->i;
  i = (reg)->i;

  return i;
}

Yields:

prreg.cc:5:20: warning: call-clobbered register used for global register
variable
 register struct s *reg __asm__( "1" );
                    ^
prreg.cc: In function âint f()â:
prreg.cc:12:8: error: address of explicit register variable âregâ requested
   i = (reg)->i;
        ^

Please note, that the line 11 "i = reg->i;" works.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]