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

            Bug ID: 42580
           Summary: missed optimization leading to compiletime assert with
                    address sanitizer
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: a...@linaro.org
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

The current clang-9 prerelease causes one file in the linux kernel to get fail
compilation with an assertion triggering when building with
-sanitize=kernel-address:

void __iwl_err(char *, ...);
int a;
void iwl_fw_dbg_apply_point() {
  const char b[] = "WRT ext=%d. Invalid apply point %d for %s\n";
  if (a) {
    void __compiletime_assert_2790(void);
    if (b[sizeof(b) - 2] != '\n')
      __compiletime_assert_2790();
  }
  __iwl_err(0, b);
}

$ clang-9 -O2 -fsanitize=kernel-address  -S dbg.i -o-    | grep compiletime
        callq   __compiletime_assert_2790

both clang-8 and gcc-8 pass the assertion here.

See also https://godbolt.org/z/cPrkv4

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

Reply via email to