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 target/61044] New: Computed goto on AVR fails to use word-addressing


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

            Bug ID: 61044
           Summary: Computed goto on AVR fails to use word-addressing
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dinuxbg at gmail dot com

Created attachment 32727
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32727&action=edit
Failed computed goto C example

The computed goto example taken straight from the GCC manual generates
incorrect code for AVR. When doing pointer arithmetic, the compiler fails to
mark labels with gs.

The following snippet from the attached test_fail C function:
    static const int array[] = { &&foo - &&foo, &&bar - &&foo, &&hack - &&foo
};
will generate the following rodata:
array.1464:
        .word   0
        .word   .L3-(.L2)
        .word   .L4-(.L2)


Note that straight labels without arithmetics work just fine (see test_good in
attached cg.c):
array.1472:
        .word   gs(.L2)
        .word   gs(.L3)
        .word   gs(.L4)

I've tested with avr-gcc 4.8.2 from debian sid. But I believe bug is also
present in top of tree.


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