avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avr-gcc-12.1.0-x64-windows new warnings ?


From: address@hidden
Subject: Re: avr-gcc-12.1.0-x64-windows new warnings ?
Date: Mon, 24 Apr 2023 11:43:02 +0200 (CEST)

Hmm isnt that loading 2bytes into one ?

>----Ursprungligt meddelande----
>Från : thilo@tjps.eu
>Datum : 2023-04-24 - 10:30 ()
>Till : avr-gcc-list@nongnu.org
>Ämne : Re: avr-gcc-12.1.0-x64-windows new warnings ?
>
>Hi,
>
>Am Monday, 24 April 2023, 07:46:23 CEST schrieb Senthil Kumar:
>> > warning: array subscript 0 is outside array bounds of 'volatile
>> > uint8_t[0]' {aka 'volatile unsigned char[]'} [-Warray-bounds]
>> 
>> Presumably from the macro expansion of PORTC?
>> Can you paste the full command line? Also, can you add -E to the command
>> line and share the output?
>
>I've frequently seen this type of error on other platforms, as well.
>The warning is only generated on one of the higher optimisation levels (-O2), 
>and is a result of the compiler thinking it caught an error, where there is 
>none (at least for this particular use case).
>
>The error occurs when the linker is used to define base addresses for 
>peripherals, but system headers provide macros for access to registers with an 
>offset via array subscription, such as:
>
>From system headers:
>extern volatile uint8_t PERIPHERALA;
>#define PERIPHERALA_SOMEREG ((&PERIPHERALA)[1])
>
><linker script:>
>PERIPHERALA = 0x0080U   (set symbol PERIPHERALA to the base address)
>
>I haven't found a good way yet to fix this warning, except for disabling the
>-Warray-bounds warning for the .c file, or for the section of code where those 
>macros are invoked (#pragma). I'd be interested in a better solution.
>If this error happens right on invocation of the PORTC macro, I guess, this 
>warning needs to be addressed in the avr-gcc system header themselves:
>
>extern volatile uint8_t PERIPHERALA[10];   /* size of peripheral addr space */
>#define PERIPHERALA_SOMEREG (PERIPHERALA[1])
>
>--
>Best regards,
>Thilo Schulz
>
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]