<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - init_priority(65535) behavior differs from g++"
   href="https://bugs.llvm.org/show_bug.cgi?id=38326">38326</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>init_priority(65535) behavior differs from g++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>stephane.zimmermann@trust-in-soft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20602" name="attach_20602" title="Test case">attachment 20602</a> <a href="attachment.cgi?id=20602&action=edit" title="Test case">[details]</a></span>
Test case

The following program:
extern "C" int printf(const char *, ...);

struct Foo {
    Foo(int x) { printf("INIT: %d\n", x); }
};

Foo f(1);
Foo f2(2);
Foo f3(3);

__attribute__((init_priority(101)))
Foo g0(101);

__attribute__((init_priority(65534)))
Foo g(65534);

__attribute__((init_priority(65535)))
Foo h(65535);

int main(void) {
    return 0;
}

- when compiled with clang++ (5.0.0) displays:
INIT: 101
INIT: 65534
INIT: 65535
INIT: 1
INIT: 2
INIT: 3

- when compiled with g++ (5.4.0) displays:
INIT: 101
INIT: 65534
INIT: 1
INIT: 2
INIT: 3
INIT: 65535

g++ seems to consider that init_priority 655535 happens after standard dynamic
initialization.</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>