public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Gnu compiler version 4.7.0, dialect -std=c99 with -fshort-enums vs. GHS with --short_enum
@ 2024-03-07 14:11 Homam Alkhateeb
  2024-03-07 14:20 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Homam Alkhateeb @ 2024-03-07 14:11 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]

Hello GCC-Support Team,

we're using the gcc compiler version 4.7.0 and dialect -std=c99 with Option -fshort-enums to compile a C project on a Host Simulation using TESSY.
according to the Using the GNU Compiler Collection<https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc.pdf> Page 302: if there are negative values it is the first of signed char, short and int that can represent all the values, otherwise it is the first of unsigned char, unsigned short and unsigned int that can represent all the values.

On the Real Target we use the GHS_PPC_Compiler_2022_1_4 C99 with the --short_enum option. We want to make short enums identical for both Compiler.
according to the PPC ABI, enum members are signed. The --short_enum option instructs the compiler to use the smallest possible data type:
First short, then unsigned short, then signed int, then unsigned int etc.

e.g.

typedef enum
{
    MY_ENUM_A = 0,
    MY_ENUM_A = 256
} MY_ENUM;

MY_ENUM Value;  /* Value is here short using GHS_PPC_Compiler_2022_1_4 C99 with the --short_enum
                                       but unsigned short using GNU with the -fshort_enums */

Mit freundlichen Grüßen / Best regards
Homam Alkhateeb
KOPF GmbH / Kapbachstr. 6 / 76829 Landau / Germany
Tel.: +49 6341 91767-36 / Email: homam.alkhateeb@kopfweb.de
<mailto:homam.alkhateeb@kopfweb.de>Geschäftsführer: Oliver Kopf - HRB Landau Nr. 3090 - Amtsgericht Landau


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-08 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07 14:11 Gnu compiler version 4.7.0, dialect -std=c99 with -fshort-enums vs. GHS with --short_enum Homam Alkhateeb
2024-03-07 14:20 ` Jonathan Wakely
2024-03-08  7:36   ` AW: " Homam Alkhateeb
2024-03-08 14:11     ` Segher Boessenkool
2024-03-08 14:24       ` AW: " Homam Alkhateeb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).