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: unassignedb...@nondot.org
          Reporter: douglas_y...@playstation.sony.com
                CC: llvm-bugs@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",@progbits,8
      ^
test.s:63:2: warning: setting incorrect section attributes for .rodata.cst8
      .section        .rodata.cst8,"aM",@progbits,8
      ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to