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 debug/31391] New: [4.3 Regression] undefined label with -O -g


I get the following link error with 4.3 and -O -g:

$ gcc -c -g -O test.c -o test.o
$ gcc -o m m.c test.o
test.o:(.debug_info+0x539): undefined reference to `.L4'
collect2: ld returned 1 exit status

test.c:

#include <netdb.h>
#include <stdio.h>
#include <malloc.h>

typedef struct _hostEntry {
    struct _hostEntry   *next;
    int     type;
} HostEntry;

typedef struct _displayEntry {
    struct _displayEntry    *next;
    int                     type;
    int                     chooser;
    HostEntry               *hosts;
} DisplayEntry;

char* name;
char *ReadWord(FILE *file) {
    return name;
}

static HostEntry *
ReadHostEntry (FILE *file)
{
    char            *hostOrAlias;
    HostEntry       *h;
    struct hostent  *hostent;

tryagain:
    hostOrAlias = ReadWord (file);
    if (!hostOrAlias)
        return NULL;
    h = (HostEntry *) malloc (sizeof (DisplayEntry));
        if (!hostent)
        {
            free ((char *) h);
            goto tryagain;
        }
    return h;
}

static DisplayEntry *
ReadDisplayEntry (FILE *file)
{
    DisplayEntry    *d;
    HostEntry       *h, **prev;
    struct hostent  *hostent;

    switch (hostent->h_addrtype)
    {
    default:
        break;
    }
    prev = &d->hosts;
    while ((h = ReadHostEntry (file)))
    {
        if (h->type == 3)
        {
            d->chooser = 1;
        }
         else {
            *prev = h;
            prev = &h->next;
        }
    }
    return d;
}

int ScanAccessDatabase (FILE *file)
{
    ReadDisplayEntry (file);
}


m.c:

int main() {
}


-- 
           Summary: [4.3 Regression] undefined label with -O -g
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com


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


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