public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Homam Alkhateeb <Homam.Alkhateeb@kopfweb.de>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Gnu compiler version 4.7.0, dialect -std=c99 with -fshort-enums vs. GHS with --short_enum
Date: Thu, 7 Mar 2024 14:11:00 +0000	[thread overview]
Message-ID: <1470a2d3f72c4cfe83943606802b0b3e@kopfweb.de> (raw)

[-- 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


             reply	other threads:[~2024-03-07 14:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 14:11 Homam Alkhateeb [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470a2d3f72c4cfe83943606802b0b3e@kopfweb.de \
    --to=homam.alkhateeb@kopfweb.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).