On 24 October 2014 17:05, Andrew Pinski <pins...@gmail.com> wrote:
> On Fri, Oct 24, 2014 at 8:11 AM, Tejas Belagod <tejas.bela...@arm.com> wrote:

>> The diagnostic issued points to the line in arm_neon.h, but we expect this
>> to point to the line in cr.c. I suspect we need something closer to the
>> front-end?
>
>
> You need to change arm_neon.h to use the __artificial__ attribute as I
> mentioned before.  Also please move away from "static inline" since
> they cannot be used from templates in C++98/03.

The __artificial__ attribute seems like it would improve the debug
view, but it does not seem to affect the location of error reporting.

As an example (static inline from current code - will fix later)
=== t_artificial.h ===
/* extracted from arm_neon.h */
typedef float float32_t;
typedef __builtin_neon_sf float32x2_t   __attribute__ ((__vector_size__ (8)));

__extension__ static __inline float32_t __attribute__
((__always_inline__,__artificial__)) vget_lane_f32 (float32x2_t __a,
const int __b)
{
  return (float32_t)__builtin_neon_vget_lanev2sf (__a, __b, 3);
}

=== t_artificial.c ===
#include "t_artificial.h"

int f(float32x2_t x) {
    int i = 3;
    float a = vget_lane_f32(x, i);
}
=== end ===

$ arm-unknown-linux-gnueabihf-gcc -c - t_artificial.c -mfpu=neon

In file included from t_artificial.c:1:0:
t_artificial.h: In function ‘f’:
t_artificial.h:7:10: error: argument must be a constant
   return (float32_t)__builtin_neon_vget_lanev2sf (__a, __b, 3);
          ^
(...followed by an ICE because we allow this to result in an invalid
insn, Jakub has explained how to address this)


The error is reported in t_artificial.h, rather than t_artificial.c:5
which is where the user has made the mistake.
https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html says that
the artificial attribute affects generated debug info and doesn't
mention error reporting at all.

Thanks
Charles

Reply via email to