[llvm-bugs] [Bug 37997] New: Compiler generating assembly that causes a warning about incorrect section attributes when assembled

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 29 18:37:22 PDT 2018


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

            Bug ID: 37997
           Summary: Compiler generating assembly that causes a warning
                    about incorrect section attributes when assembled
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org

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

-- 
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/20180630/562aacaa/attachment.html>


More information about the llvm-bugs mailing list