Menu

#2183 GCC: command line globbing may affect macro name case sensitivity

OTHER
unread
nobody
Bug
none
Unknown
False
2014-08-19
2014-02-11
Stigmha
No

Subdirectories with the same name as a defined macro makes the macro case insensitive. See the attached PoC which was made by James Canete. A real life scenario affected by the bug can be found here: https://bugzilla.icculus.org/show_bug.cgi?id=6087

1 Attachments

Related

Issues: #2160

Discussion

  • Keith Marshall

    Keith Marshall - 2014-02-11
    • labels: GCC, Subdirectory, Macro --> GCC, Macro, globbing, case-sensitivity
    • summary: Subdirectories makes user macros case insensitive --> GCC: command line globbing may affect macro name case sensitivity
     
  • Keith Marshall

    Keith Marshall - 2014-02-11

    Thank you for the wonderfully concise test case! My only criticisms are that you neglected to identify the version of GCC which exhibits this misbehaviour, and you have only partially identified the problem, (causing you to describe it incorrectly).

    I'm guessing that it is Earnie's GCC-4.8.1 build which is affected, since I can reproduce the same symptom with that build, but not with the earlier GCC-4.7.2 build, nor with my own GCC-4.8.2 test build, (which I've begun preparing as a step in the investigation of bug [#2108]).

    I suspect that this is another side effect of bug [#2062]; (I'm assuming that Earnie's GCC-4.8.1 build is statically linked with a libmingwex.a which includes the buggy glob.c; I've already fixed that in my workspace). I base this on:

    1. The symptom is apparent only for macros defined on the GCC command line; those specified by #define statements within the source file do not seem to be affected.

    2. The symptom is not specific to case-insensitively matched subdirectory name vs. macro name conflicts; it is identically evident for any file system entity, (as may be seen with this extended variation on your test case):

    <nowiki></nowiki>

    $ gcc --version
    gcc.exe (GCC) 4.8.1
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ echo 'unsigned int ui;' > foo.c
    
    $ mkdir ui
    
    $ gcc -DUI -c foo.c
    <command-line>:0:4: error: expected identifier or '(' before numeric constant
    foo.c:1:14: note: in expansion of macro 'ui'
     unsigned int ui;
                  ^
    
    $ rmdir ui
    
    $ gcc -DUI -c foo.c
    
    $ > ui
    
    $ gcc -DUI -c foo.c
    <command-line>:0:4: error: expected identifier or '(' before numeric constant
    foo.c:1:14: note: in expansion of macro 'ui'
     unsigned int ui;
                  ^
    
    $ rm ui
    
    $ gcc -DUI -c test.c
    
     

    Related

    Issues: #2062
    Issues: #2108

    • Stigmha

      Stigmha - 2014-02-11

      I am sorry for leaving crucial information out, but you were perfectly right. It is GCC 4.8.1. I am looking forward to your release of 4.8.2.

      $ mingw-get show gcc-bin
      
      Package: mingw32-gcc                                  Subsystem: mingw32
      Component: bin
      
      Installed Version:  gcc-core-4.8.1-4-mingw32-bin.tar.lzma
      Repository Version: gcc-core-4.8.1-4-mingw32-bin.tar.lzma
      
       
MongoDB Logo MongoDB