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/17205] New: Strange behaviour when function prototypes appear inside other functions


gcc version 3.5.0 20040827 (experimental)

A 2.6 kernel compilation encountered a link failure. The following sequence
shows how things fail if a function protoype appears inside another function:

#define BROKE

#ifndef BROKE
static void foo(void);
#endif

int main()
{
#ifdef BROKE
        static void foo(void);
#endif
        foo();
}

static void foo(void)
{
        printf("bar\n");
}

define BROKE and foo disappears completely, undefine it and it works as
expected. To be honest Im not even sure this is valid C.

-- 
           Summary: Strange behaviour when function prototypes appear inside
                    other functions
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu


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


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