Created attachment 14626 [details] Example showing the assert The AArch64TargetInfo class sets RegParmMax to 8, however in include/clang/Basic/TargetInfo.h there is an assert that RegParmMax < 7. The attached file shows the issue when built with: clang -cc1 -triple aarch64-unknown-freebsd11.0 regparam_test.c Building this with clang 3.6 from FreeBSD and clang 3.8 I get the following: Assertion failed: (RegParmMax < 7 && "RegParmMax value is larger than AST can handle"), function getRegParmMax, file /home/andrew/freebsd/repo/llvm/tools/clang/include/clang/Basic/TargetInfo.h, line 824.
IIUC, the expected behaviour is to produce an error on the attached file, just like clang does for other non-x86 backends? $ clang -target armv7 t.c t.c:1:32: error: 'regparm' is not valid on this platform void foo(void) __attribute__ ((regparm(3))); ^ ~ 1 error generated.
(In reply to comment #1) > IIUC, the expected behaviour is to produce an error on the attached file, > just like clang does for other non-x86 backends? That seems correct to me. It looks like the port failures we're encountering are caused by using regparm unconditionally, rather than in some x86 #ifdef - e.g., http://www.ohse.de/uwe/ftpcopy/ has > #if GNUC_MINIMUM(2,7) /* doesn't work reliable before, IIRC */ > # define attribute_regparm(x) __attribute__((__regparm__((x)))) > #else > # define attribute_regparm(x) > #endif > static void attribute_regparm(2) > outplus(uogetopt_env *e, const char *s) > { ... So there are likely bugs for us to file for each of these ports, although the compiler should also behave as you suggest.
This is fixed by r243417.