[PATCH] D16171: Warning on redeclaring with a conflicting asm label

Nick Lewycky via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 14 14:28:17 PST 2016


On 14 January 2016 at 10:38, Weiming Zhao via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> weimingz added a comment.
>
> Hi Nick,
>
> Below is a reduced code:
> t.c:
>
>   static long double acoshl (long double __x) __asm__ ("" "acosh") ;  //
> this is from <gcc4.9>/arm-linux-gnueabi/libc/usr/include/bits/mathcalls.h
>   extern long double acoshl (long double) __asm__ ("" "__acoshl_finite") ;
> // this is from existing code
>
> GCC gives warning like:
> /tmp/t.c:2:1: warning: asm declaration ignored due to conflict with
> previous rename [-Wpragmas]
>  extern long double acoshl (long double) __asm__ ("" "__acoshl_finite") ;
>

That's the same case as in this testcase:

  void foo() __asm__("one");
  void foo() __asm__("two");
  void test() { foo(); }

GCC emits a call to 'one' while Clang emits a call to 'two'. This is a real
bug. Please don't downgrade this to a warning.

As an alternative, I would accept a patch which changes how clang generates
code so that it also produces a call to 'one', with a warning. It looks
like what we need to do is drop subsequent asm label declarations on
functions that already have one.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160114/6ea752f7/attachment.html>


More information about the cfe-commits mailing list