Is there a way to do this without changing the code? Mit freundlichen Grüßen / Best regards Homam Alkhateeb KOPF GmbH / Kapbachstr. 6 / 76829 Landau / Germany Tel.: +49 6341 91767-36 / Email: homam.alkhateeb@xxxxxxxxxx Geschäftsführer: Oliver Kopf - HRB Landau Nr. 3090 - Amtsgericht Landau -----Ursprüngliche Nachricht----- Von: Jonathan Wakely <jwakely.gcc@xxxxxxxxx> Gesendet: Donnerstag, 7. März 2024 15:20 An: Homam Alkhateeb <Homam.Alkhateeb@xxxxxxxxxx> Cc: gcc-help@xxxxxxxxxxx Betreff: Re: Gnu compiler version 4.7.0, dialect -std=c99 with -fshort-enums vs. GHS with --short_enum On Thu, 7 Mar 2024 at 14:11, Homam Alkhateeb <Homam.Alkhateeb@xxxxxxxxxx> wrote: > > 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 Add a negative value, MY_ENUM_NEG = -1 Now GCC will use short instead of unsigned short. > } 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@xxxxxxxxxx > <mailto:homam.alkhateeb@xxxxxxxxxx>Geschäftsführer: Oliver Kopf - HRB > Landau Nr. 3090 - Amtsgericht Landau >