diff mbox series

testsuite: Add -fno-short-enums to pr97315-1.C

Message ID 20240816141509.2979995-1-torbjorn.svensson@foss.st.com
State New
Headers show
Series testsuite: Add -fno-short-enums to pr97315-1.C | expand

Commit Message

Torbjörn SVENSSON Aug. 16, 2024, 2:15 p.m. UTC
Ok for trunk and releases/gcc-14?

--

The test case assumes that sizeof(tree_code) >= 2. On some targets, like
Cortex-M on arm-none-eabi, -fshort-enums is enabled by default and in
that case, sizeof(tree_code) will be 1 and the following warning is
emitted:

.../pr97315-1.C:8:13: warning: width of 'tree_base::code' exceeds its type

Avoid the warning by forcing -fno-short-enums.

gcc/testsuite/ChangeLog:

	* g++.dg/opt/pr97315-1.C: Add -fno-short-enums.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gcc/testsuite/g++.dg/opt/pr97315-1.C | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Jelinek Aug. 16, 2024, 2:37 p.m. UTC | #1
On Fri, Aug 16, 2024 at 04:15:10PM +0200, Torbjörn SVENSSON wrote:
> Ok for trunk and releases/gcc-14?
> 
> --
> 
> The test case assumes that sizeof(tree_code) >= 2. On some targets, like
> Cortex-M on arm-none-eabi, -fshort-enums is enabled by default and in
> that case, sizeof(tree_code) will be 1 and the following warning is
> emitted:
> 
> .../pr97315-1.C:8:13: warning: width of 'tree_base::code' exceeds its type
> 
> Avoid the warning by forcing -fno-short-enums.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/opt/pr97315-1.C: Add -fno-short-enums.
> 
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>

Ok, thanks.

	Jakub
Torbjörn SVENSSON Aug. 16, 2024, 2:44 p.m. UTC | #2
On 2024-08-16 16:37, Jakub Jelinek wrote:
> On Fri, Aug 16, 2024 at 04:15:10PM +0200, Torbjörn SVENSSON wrote:
>> Ok for trunk and releases/gcc-14?
>>
>> --
>>
>> The test case assumes that sizeof(tree_code) >= 2. On some targets, like
>> Cortex-M on arm-none-eabi, -fshort-enums is enabled by default and in
>> that case, sizeof(tree_code) will be 1 and the following warning is
>> emitted:
>>
>> .../pr97315-1.C:8:13: warning: width of 'tree_base::code' exceeds its type
>>
>> Avoid the warning by forcing -fno-short-enums.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 	* g++.dg/opt/pr97315-1.C: Add -fno-short-enums.
>>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> 
> Ok, thanks.
> 
> 	Jakub
> 


Pushed as r15-2951 and r14-10593.

Kind regards,
Torbjörn
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/opt/pr97315-1.C b/gcc/testsuite/g++.dg/opt/pr97315-1.C
index 5a618d8e1e8..3e439c5f179 100644
--- a/gcc/testsuite/g++.dg/opt/pr97315-1.C
+++ b/gcc/testsuite/g++.dg/opt/pr97315-1.C
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O3 -fno-exceptions" } */
+/* { dg-options "-O3 -fno-exceptions -fno-short-enums" } */
 
 typedef struct tree_node *tree;
 enum tree_code { RECORD_TYPE, QUAL_UNION_TYPE };