<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 - Compiler generating assembly that causes a warning about incorrect section attributes when assembled"
   href="https://bugs.llvm.org/show_bug.cgi?id=37997">37997</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler generating assembly that causes a warning about incorrect section attributes when assembled
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>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>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Upstream change r335558 added a warning when the compiler assembles a file that
contains section attributes that are incorrect for certain sections. The
problem is that the compiler itself generates these incorrect attributes, so
either the warning should be relaxed, or the compiler fixed if it is truly
incorrect to generate.

Consider the following code:

/* test.cc */
static volatile int v;

static void __attribute__((noinline))
e (int i, double j) {
  v = 0;
}
static void __attribute__((noinline))
d (int i, double j) {
  e (i, ++j);
}
static void __attribute__((noinline))
c (int i, double j) {
  d (i * 20, j * 20);
}
static void __attribute__((noinline))
a (int i, double j) {
  d (i + 1, j + 1);
}

int main () {
  if (v)
    a (1, 1.25);
  else
    c (5, 5.25);
  return 0;
}

Using a linux compiler built from r335558, I generated an assembly file, and
then fed the assembly file back into the compiler like this:

clang -g -O2 -S test.cc -o test.s
clang test.s

Doing that causes the compiler to emit the following warnings:

test.s:40:2: warning: setting incorrect section attributes for .rodata.cst8
      .section        .rodata.cst8,"aM",@progbits,8
      ^
test.s:63:2: warning: setting incorrect section attributes for .rodata.cst8
      .section        .rodata.cst8,"aM",@progbits,8
      ^</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>