public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/28342]  New: undefined symbol [local label] for goto from nested function [SPARC]
@ 2006-07-11 14:15 markosc at interia dot pl
  2006-07-11 21:07 ` [Bug middle-end/28342] " pinskia at gcc dot gnu dot org
  2010-09-20 22:30 ` [Bug middle-end/28342] undefined symbol [local label] for goto from nested function and switch ebotcazou at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: markosc at interia dot pl @ 2006-07-11 14:15 UTC (permalink / raw)
  To: gcc-bugs

If there are two goto's that exit from nested functions and go to the same
label in main function, gcc generates references to two different labels, but
generates only one label to jump to. Result is undefined symbol and linking
error. This happens on both SPARC and SPARC64, both -O0 and -O3. However, x86
version works fine.

$ cat xb.c
int bar();

extern int en;

int foo ( ) {
        __label__ err;
        int res = 0;
        void e1 ( ) {
                res = -1;
                en = 1;
                goto err;
        }
        void e2 ( ) {
                res = -1;
                en = 2;
                goto err;
        }
        while (1) {
                switch (bar()) {
                        case 1: 
                                e1();
                        case 2: 
                                e2();
                        case 3: 
                                goto breakw;
                        case 4: 
                                res++;
                }
                continue;
breakw:
                break;
        }
err:
        return res;
}
$ sparc64-elf64-linux-gcc -m32 -c xb.c -o xb.o
$ sparc64-elf64-linux-nm xb.o
         U bar
0000011c t e1.1118
000000d8 t e2.1120
         U en
00000000 T foo
         U .LL17

The problem also happens [though with different label name] for -m64 and/or
-O3.

The workaround is to reduce number of outside goto's per target label to 1,
either by throwing some goto's away, or declaring multiple labels in the target
place, having only one goto to each of them.


-- 
           Summary: undefined symbol [local label] for goto from nested
                    function [SPARC]
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markosc at interia dot pl
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sparc64-elf64-linux-gnu


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


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

* [Bug middle-end/28342] undefined symbol [local label] for goto from nested function [SPARC]
  2006-07-11 14:15 [Bug target/28342] New: undefined symbol [local label] for goto from nested function [SPARC] markosc at interia dot pl
@ 2006-07-11 21:07 ` pinskia at gcc dot gnu dot org
  2010-09-20 22:30 ` [Bug middle-end/28342] undefined symbol [local label] for goto from nested function and switch ebotcazou at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-11 21:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Severity|major                       |normal
          Component|target                      |middle-end


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


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

* [Bug middle-end/28342] undefined symbol [local label] for goto from nested function and switch
  2006-07-11 14:15 [Bug target/28342] New: undefined symbol [local label] for goto from nested function [SPARC] markosc at interia dot pl
  2006-07-11 21:07 ` [Bug middle-end/28342] " pinskia at gcc dot gnu dot org
@ 2010-09-20 22:30 ` ebotcazou at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-09-20 22:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ebotcazou at gcc dot gnu dot org  2010-09-20 22:30 -------
Investigating.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-20 22:30:27
               date|                            |


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


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

end of thread, other threads:[~2010-09-20 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-11 14:15 [Bug target/28342] New: undefined symbol [local label] for goto from nested function [SPARC] markosc at interia dot pl
2006-07-11 21:07 ` [Bug middle-end/28342] " pinskia at gcc dot gnu dot org
2010-09-20 22:30 ` [Bug middle-end/28342] undefined symbol [local label] for goto from nested function and switch ebotcazou 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).