Debian Bug report logs - #1063882
gcc: Internal error from ternary cond as inline asm parameter

version graph

Package: gcc; Maintainer for gcc is Debian GCC Maintainers <[email protected]>; Source for gcc is src:gcc-defaults (PTS, buildd, popcon).

Reported by: VictorBW <[email protected]>

Date: Wed, 14 Feb 2024 01:15:01 UTC

Severity: normal

Tags: moreinfo

Found in version gcc-defaults/1.203

Full log


Message #17 received at [email protected] (full text, mbox, reply):

Received: (at 1063882) by bugs.debian.org; 15 Feb 2024 01:54:49 +0000
From [email protected] Thu Feb 15 01:54:49 2024
X-Spam-Checker-Version: SpamAssassin 3.4.6-bugs.debian.org_2005_01_02
	(2021-04-09) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-3.7 required=4.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY,
	GMAIL,HAS_BUG_NUMBER,HTML_MESSAGE,MULTALT,RCVD_IN_DNSWL_NONE,
	SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no
	autolearn_force=no version=3.4.6-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 25; hammy, 143; neutral, 50; spammy,
	0. spammytokens: hammytokens:0.000-+--XDebbugsCc,
	0.000-+--X-Debbugs-Cc, 0.000-+--Maintainer, 0.000-+--char**,
	0.000-+--int64_t
Return-path: <[email protected]>
Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]:47576)
	by buxtehude.debian.org with esmtps (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128)
	(Exim 4.94.2)
	(envelope-from <[email protected]>)
	id 1raQxN-00Cow0-HM
	for [email protected]; Thu, 15 Feb 2024 01:54:49 +0000
Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-dcc73148611so354483276.3
        for <[email protected]>; Wed, 14 Feb 2024 17:54:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1707962070; x=1708566870; darn=bugs.debian.org;
        h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
         :date:message-id:reply-to;
        bh=uPeO73aJHx+zgsiy8GSJxiM+aLcR0jW8FLpn9nu2mw0=;
        b=ekvN7YY2x44oOtZtNDLybMoy03KCdS9jsiyM90YZilBQBpGISIXNrfISKytOFPE7vn
         Ty3L9c3EOya3j+cuNGYeq6NuwrGRMMVs0Or3SOYm9GqQCXcxaKXJiB6+nrc4Tgdqv/3b
         sokH91oK9T0Ut4+8+0RPUtxGzLDqoIuXHPb24/CL1e03gmc4xUTB5wEHBdw3q1gRhXql
         T5GBl13SlvQgY7Rn7PT/hfJTkRBDXuM84A+psX8tJ/AHNtWrZ1/K+AEt/cM5RlD8A/se
         aKvhslFDvoGj7X0i7Nj/iswO29/8kl22HkWCEGb6o/xWdzWsgKA373Edan9gXHZwvPEB
         hvoA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1707962070; x=1708566870;
        h=to:subject:message-id:date:from:mime-version:x-gm-message-state
         :from:to:cc:subject:date:message-id:reply-to;
        bh=uPeO73aJHx+zgsiy8GSJxiM+aLcR0jW8FLpn9nu2mw0=;
        b=jTv35DYWNckWKSItkjfufHsWGy7FEQqPYHKKoRsPThw0YGjufrteE8gjRMCK1LnrVC
         KOrKk6zXZR7roSQmtHVKfx6LwoiXFqDkpPboiQpEt4Obyf/1A5OPm4hV1wLUQ493Xtbn
         gtPtT/bnwXSgQY/a5KoMDUgu+noNsi+z04+nNOyHAi/pK3j0xw/EYcbWZalQNx9TwBbG
         O/ktpV2NdOPx1yxHsD/eEmkSukhoY72zz3iJoFASfvMDJBVe6+Kc6kDO3tYd208+2wUh
         nBHXJDB5cXNwKvHEcNNmysgL4fA/h/fd5nkpoTBPza2b8IwZ1ijDXDUUGuehjKxU0OP+
         V/7A==
X-Gm-Message-State: AOJu0Yyct4psTHgxzdGo/n9YmTLuNh1juNIgHcxw+cgk40phKym/o5c3
	ukx1uURdFHAY+IPlXgdNdGRHX6jFdGZMi4S4nZ4f6KnEqsd1Kn1qjsuc8dg1x51oYSJgxPPr8mo
	85MMhDkohGavnTV2xcaQQAn6vV61vEzBRzkg=
X-Google-Smtp-Source: AGHT+IFfiylCCHpr/MNsXZ24P124YcNuE6m1T8MPnACdLDFI1xlb9fCzvnqnbGaoRGBJ/5/rknvn50c+d4bvWnYBo7c=
X-Received: by 2002:a25:aaa5:0:b0:dc6:e622:f52 with SMTP id
 t34-20020a25aaa5000000b00dc6e6220f52mr333437ybi.31.1707962070442; Wed, 14 Feb
 2024 17:54:30 -0800 (PST)
MIME-Version: 1.0
From: some body <[email protected]>
Date: Thu, 15 Feb 2024 01:54:19 +0000
Message-ID: <CAHZxmGy90oLse3Cx+vSMXLZuCMqAzUcGXYGVT4B6sQxNzTS+gA@mail.gmail.com>
Subject: Re: Bug#1063882: gcc: Internal error from ternary cond as inline asm parameter
To: [email protected]
Content-Type: multipart/alternative; boundary="0000000000007fa7c4061161e825"
[Message part 1 (text/plain, inline)]
On Wed, 14 Feb 2024 08:26:41 +0100 Matthias Klose <[email protected]> wrote:
> Control: tags -1 + moreinfo
>
> On 14.02.24 02:10, VictorBW wrote:
> > Package: gcc
> > Version: 4:12.2.0-3
> > Severity: normal
> > X-Debbugs-Cc: [email protected]
> >
> > Dear Maintainer,
> >
> > I wanted to dynamically select registers for use in an inline assembly
statement, so I tried the questionmark conditional operator, as in this
minimal example:
> >
> > namespace gpr {
> >    volatile register int64_t r12 asm("r12");
> >    volatile register int64_t r13 asm("r13");
> > ...
> > asm volatile ("mov %0, blah" : "+r"((reg) ? gpr::r13 : gpr::r12));
> >
>
> please post the complete code example.
>
> please also recheck with newer GCC versions (GCC 13, GCC 14) in newer
> Debian development versions.
>
I do not have GCC 13/14 installed, but godbolt.org's copy of GCC 13 and
trunk will not compile the following complete example

int main(int argc, char** argv) {
register long reg_1 asm("r12");
register long reg_2 asm("r13");
asm volatile ("mov %0, %%r11" : "+r"((argc) ? reg_2 : reg_1));
}

I note that in C mode (gcc minbug.c) a different error is produced (error:
lvalue required in ‘asm’ statement), but in C++ mode (g++ minbug.c) we get
the internal compiler error, and that selecting an input parameter the same
way (rather than an output parameter) seems to work correctly.
[Message part 2 (text/html, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 17:54:04 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.