[LLVMbugs] [Bug 9839] New: missing negative options: -fno-pic and -fno-PIC

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 4 05:52:10 PDT 2011


           Summary: missing negative options: -fno-pic and -fno-PIC
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nobled at dreamwidth.org
                CC: llvmbugs at cs.uiuc.edu

I tested gcc's behavior when these flags are combined with their opposites on
an x86-32 Ubuntu install, and it actually seems to consider -fno-pic and
-fno-PIC to have the same meaning: don't define __pic__ or __PIC__ at all. Not
sure if that's a bug or intentional (I'd expected "-fpic -fno-PIC" to define
them to 1), since the behavior isn't specifically documented, just the fact
that "Most [options] have both positive and negative forms":

$ gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
$ gcc -fsyntax-only pic.c -fpic -fPIC -fno-PIC
pic.c:3: error: #error __pic__ not defined
$ gcc -fsyntax-only pic.c -fpic -fPIC -fno-pic
pic.c:3: error: #error __pic__ not defined
$ gcc -fsyntax-only pic.c -fpic -fno-PIC
pic.c:3: error: #error __pic__ not defined
$ gcc -fsyntax-only pic.c -fno-PIC -fpic
pic.c:5: error: #error __pic__ equals 1
$ gcc -fsyntax-only pic.c -fno-pic -fPIC
pic.c:5: error: #error __pic__ equals 2
$ cat pic.c

#ifndef __pic__
#error __pic__ not defined
#elif __pic__ == 1
#error __pic__ equals 1
#elif __pic__ == 2
#error __pic__ equals 2
#error WTF

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list