From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 1FAD13857C65 for ; Thu, 7 Mar 2024 14:20:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1FAD13857C65 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1FAD13857C65 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709821231; cv=none; b=LeNV11xZy5BGQSAjtOyJqCKOwryKUC0JogYhm9Sgk4ePoCsCDDpF009FNtGQvt/W2rpgppBGSiefCNcnsNZ/igdTn25WqAfnBIltf9OCHw27drRATOKCjEPEi0OTta84uQPK4SBs/OKpzccuEbFGOigcUT29Ai51rvYjTWqLOIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709821231; c=relaxed/simple; bh=sJXQp3OjgXKaBTeWTchWIhaIltL3m7ZzekGHuZjuCsQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Sf+ScZLXO61m6zSh1BOseOUx+a/P50PvOR/wRMiJEH8fRCLPETlj3JSL5weDrdl3YTVq7wyuV1tMyMtjpu60Zl4HHwgLEFBi/kwQjpdobbWYCb0NgHxHVAcvIaRWm0igMC14f3hLGjaWrIkd5+NxUkBcdihLy1H+1AUkqzZwbiw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-563cb3ba9daso1068372a12.3 for ; Thu, 07 Mar 2024 06:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709821229; x=1710426029; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hZycZkPj1vyvUhAud3wal9FX44ujAKMTrhTTac2Au9I=; b=kk465DuhGHnnnSCocx3WXrPzjLfBzKBqEsTbNMRiWOGY+Mams3PU2a09m72wrQFcGD Vje3flztJJX1mc50k8JYQeJvclplIn3w6Wu2DQLsH0UO8/K2FDtQZEXhvjjHP/MbuqSD 7bYE++vUO9W44zumWm3JdMx6Ikxe+F/qTHHDPv6xyb0a3kL2IAp4yGe9l4lSs0XGcuK4 W8UYJer9o77OnvaA+OtY3Hn4ixzXlIfjsZ059gT9burvYdK7MHlEO2abrGSfKox2sZ0s +Fq+4iTqZSkuOp89M0wtTz9jHVZHAStRHw4eE8VPqNws8Pe1wYuwW98oQ8RrcF9VW7st trpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709821229; x=1710426029; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hZycZkPj1vyvUhAud3wal9FX44ujAKMTrhTTac2Au9I=; b=JhaSC31/jgSaVoefwWEU0/DXDAtJObXf07YNR9rzXnInX2iHuTSlVYaR0agPbv9i3N aCtiI2Jp12J3oddfhPG+WvP/ehjcCRcCPSY/5nIIVZc6uFEgoVWgI1tG1JCP9Vbo7guI rucBn0eTXvurUPoF1TKlWRnM+0o3XWRyh/Nck0/o27Q58BQJ9XlmdVM8DIBzIKF2ghxN fIuY2GRqKLH+Vn2NFDanUl++PR8H7hvkV1rgon/U08FFU0rBLNLQ325NibllPGzT9nRc ToMC2mNzACE7/lwQT19WzzEAdLycNRHpeV6zD1e6DDy5rWgzSync7thuMf7+gWK3iWrs goDw== X-Gm-Message-State: AOJu0Yw42otWX6nu30Gr8vLzV1N2jjSbONyW4xcAKKB8aYhEPcrm2sFa xD5EgEnH4PRpeQ6zp/acT8b8NXyDr0HUntaHNOV7fraEsLWCWAy3XV4XQjR6QDR5qUlMkxZJVJK FZPj+yUhfb6H0zhhT3VGtckFXel8= X-Google-Smtp-Source: AGHT+IEeX/rHeZ7ycBAgM6p6Cg9jTKsmRgZCps+c+J+NVqNqD4dXEb9tlvuSzobOj89FZfbiGcKW9sXtneGFfzoAGUY= X-Received: by 2002:a17:906:3c17:b0:a43:86f3:b00b with SMTP id h23-20020a1709063c1700b00a4386f3b00bmr12040940ejg.0.1709821228463; Thu, 07 Mar 2024 06:20:28 -0800 (PST) MIME-Version: 1.0 References: <1470a2d3f72c4cfe83943606802b0b3e@kopfweb.de> In-Reply-To: <1470a2d3f72c4cfe83943606802b0b3e@kopfweb.de> From: Jonathan Wakely Date: Thu, 7 Mar 2024 14:20:17 +0000 Message-ID: Subject: Re: Gnu compiler version 4.7.0, dialect -std=c99 with -fshort-enums vs. GHS with --short_enum To: Homam Alkhateeb Cc: "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 7 Mar 2024 at 14:11, Homam Alkhateeb w= rote: > > Hello GCC-Support Team, > > we're using the gcc compiler version 4.7.0 and dialect -std=3Dc99 with Op= tion -fshort-enums to compile a C project on a Host Simulation using TESSY. > according to the Using the GNU Compiler Collection Page 302: if there are negative values it is th= e first of signed char, short and int that can represent all the values, ot= herwise it is the first of unsigned char, unsigned short and unsigned int t= hat can represent all the values. > > On the Real Target we use the GHS_PPC_Compiler_2022_1_4 C99 with the --sh= ort_enum option. We want to make short enums identical for both Compiler. > according to the PPC ABI, enum members are signed. The --short_enum optio= n 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 =3D 0, > MY_ENUM_A =3D 256 Add a negative value, MY_ENUM_NEG =3D -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 C9= 9 with the --short_enum > but unsigned short using GNU with = the -fshort_enums */ > > Mit freundlichen Gr=C3=BC=C3=9Fen / Best regards > Homam Alkhateeb > KOPF GmbH / Kapbachstr. 6 / 76829 Landau / Germany > Tel.: +49 6341 91767-36 / Email: homam.alkhateeb@kopfweb.de > Gesch=C3=A4ftsf=C3=BChrer: Oliver Kopf= - HRB Landau Nr. 3090 - Amtsgericht Landau >