<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang 3.5.2 on cygwin generates inconsistent argc value on -O1 and higher"
   href="https://llvm.org/bugs/show_bug.cgi?id=25045">25045</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang 3.5.2 on cygwin generates inconsistent argc value on -O1 and higher
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>omoik4ne@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14996" name="attach_14996" title="Trivial C code to print value of argc">attachment 14996</a> <a href="attachment.cgi?id=14996&action=edit" title="Trivial C code to print value of argc">[details]</a></span>
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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>