Re: [RFC] Function Multi Versioning on Arm

2022-11-23 Thread Martin Liška
On 7/18/22 12:36, Daniel Kiss via Gcc wrote: > Hello, > > We are going to add Function Multiversioning [1] support to Arm architectures. > The specification is made public as beta[2] to ensure toolchain that follows > Arm > C Language Extension will implement it in the same way. > > A few tweaks

-Warray-bounds interprets int *var as int var[0] ?

2022-11-23 Thread Georg-Johann Lay
The following code throws a warning which I do not understand. Purpose is to save and restore SREG, which is a special function register (SFR) defined by its hardware address as: #define SREG (*(volatile uint8_t*) (0x3F + __AVR_SFR_OFFSET__)) which is the common C idiom to define such an SFR.

Re: -Warray-bounds interprets int *var as int var[0] ?

2022-11-23 Thread Andrew Pinski via Gcc
On Wed, Nov 23, 2022 at 9:15 AM Georg-Johann Lay wrote: > > The following code throws a warning which I do not understand. > > Purpose is to save and restore SREG, which is a special function > register (SFR) defined by its hardware address as: > > #define SREG (*(volatile uint8_t*) (0x3F + __AVR_

Re: -Warray-bounds interprets int *var as int var[0] ?

2022-11-23 Thread Georg-Johann Lay
Am 23.11.22 um 18:18 schrieb Andrew Pinski: On Wed, Nov 23, 2022 at 9:15 AM Georg-Johann Lay wrote: The following code throws a warning which I do not understand. Purpose is to save and restore SREG, which is a special function register (SFR) defined by its hardware address as: #define SR

Using size_t to crash on off-by-one errors (was: size_t vs long.)

2022-11-23 Thread Alejandro Colomar via Gcc
Hi, On 11/18/22 00:04, Alejandro Colomar wrote: The main advantage of this code compared to the equivalent ssize_t or ptrdiff_t or idx_t code is that if you somehow write an off-by-one error, and manage to access the array at [-1], if i is unsigned you'll access [SIZE_MAX], which will definite

-fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()

2022-11-23 Thread Gavin Ray via Gcc
Hey all, just a few questions about the fantastic GCC Static Analyzer: - It's stated that support for C++ vs C is very limited. Does this apply if you're writing C++ that is very similar-looking to C and uses few of C++'s advanced features? - I noticed that in C++, the "gnu::malloc" attribute