-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCC error - missing cast in MVE arm_biquad_cascade_df1_q15 #58
Comments
While looking around build systems, I've just noticed that GCC's behaviour here is configurable via |
It is advised to use But, I'll look at above case because I think it needs the cast. |
Any thoughts on the C vs C++ difference in armclang (if that's what it is)? I don't see such a thing documented. Can you control it? There were no other reports from our customer of GCC problems without the |
I don't know the differences between C and C++ for handling the intrinsics. So you confirm that for the Can you share the compilation options you used ? I'll try to reproduce and then check with our compiler team. |
Yes, I've stripped it down, and confirm that it's a C/C++ difference Given this source:
That's accepted without warnings if it's input as C:
But rejected with the type error (not warning) if it comes in as Conceptually I see no reason for C to be more lax here, and I've not found this documented as being by design. Sure, C++ is more type strict on a few scalar things, like enums and bools, but C has always been just as strict as C++ on aggregates, which these vectors effectively are. (GCC 11.3 rejects it as either C or C++, unless you have |
Compiler team tells me that the C and C++ standards are not managing implicit casts in the same way. But otherwise, for this specific example they can't say more. |
Arm C Language Extensions document just says that such implicit conversions are not portable (for C or C++) - and to use So the C compiler is free to give the error, and I think it would be far more helpful if it did. Was trying to check whether this has changed since |
Minor update, as I found some discussion elsewhere - clang and armclang do also have the Documentation for clang says the default is You can get armclang to reject the above code in C by adding Which in turn means that the change in #65 technically needs to also be applied for armclang. If someone has made vectors strict in the global CMake compile flags (or a future clang has tightened up), it needs to be overridden for the CMSIS-DSP target. |
@kjbracey Thanks for the feedback ! |
In relation with issue #58 When HELIUM, MVEF or MVEI are used as cmake options, the option LAXVECTORCONVERSIONS can be set to ON or OFF to enable / disable lax vector conversions in GCC or ArmClang. Currently, CMSIS-DSP won't build if lax vector conversions are disabled. The option is ON by default.
@kjbracey I have added a cmake option to enable / disable lax vector conversions when building for Helium with gcc or ArmClang. |
You could scale that back a bit, as I assume you don't actually need "=all", as that's not the default for clang (since clang 10), and it's laxer than gcc, which only permits the integer->integer laxness. So you can set clang to "=integer", or just use the same simple flags as gcc. "=all" is the clang-9-and-earlier default behaviour and what -flax-vector-conversions used to mean for it, but they changed it to match gcc. https://releases.llvm.org/10.0.0/tools/clang/docs/ReleaseNotes.html |
@kjbracey You're right. It build without problems with |
We've had a report that GCC doesn't like the MVE version of arm_biquad_cascade_df1_q15. And its complaint seems valid:
CMSIS-DSP/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c
Lines 105 to 108 in 302897a
I'd say you need an explicit
(q15x8_t)
cast on the output ofvsetq_lane_s32
.What's not clear to me is why armclang accepts it, which it does. Indeed, armclang doesn't seem to require the existing
(q31x4_t)
casts either, at least within that C file.Pasting the same function into some other C++ code I had handy made armclang produce the equivalent error, unless you have 3 casts. Is it performing implicit conversion in C mode, maybe? Intentionally? Possible armclang bug?
The text was updated successfully, but these errors were encountered: