[llvm-bugs] [Bug 25045] New: clang 3.5.2 on cygwin generates inconsistent argc value on -O1 and higher

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 4 11:52:06 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25045

            Bug ID: 25045
           Summary: clang 3.5.2 on cygwin generates inconsistent argc
                    value on -O1 and higher
           Product: new-bugs
           Version: 3.5
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: omoik4ne at yahoo.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14996
  --> https://llvm.org/bugs/attachment.cgi?id=14996&action=edit
Trivial C code to print value of argc

On cygwin, when compiling C or C++ code with optimizations enabled using either
clang or clang++, the value of argc passed to main() is inconsistent.

cat <<EOT > a.c
#include<stdio.h>
int main(int argc, char *argv[])
{
   printf("%d\n", argc);
   return 0;
}
EOT

% clang -O0 a.c -o a.exe && ./a.exe
1

% clang -O1 a.c -o a.exe && ./a.exe
0

A value of "0" is not technically wrong (according to 5.1.2.2.1 in ISO/IEC
9899), but I can't find another compiler that does this.  If clang were going
to do it, it should at least be consistent between -O0 and -O1.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151004/a4a8ee05/attachment-0001.html>


More information about the llvm-bugs mailing list