From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E00D13858D1E; Wed, 8 Nov 2023 02:28:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E00D13858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699410498; bh=ojGnnLWx52aWVqOwiKWXDnllD4e24mefjH2Ow77eOsw=; h=From:To:Subject:Date:From; b=M7M4V+nPyLd8iE2BRygHqHw2eO5fPjr6UyAePEnOfgaCz8HwFIrPxPIq4OcQS0SCY WFU0Qcd3Jz20h186EDOGV0855onxiDckWqTJfG/QTosmRx6c20Xbdxo8zXbU+oiktc BvWxE1XrIeJWoLx1+bB9AYVt2SVaPmeA020QS/ik= From: "rsworktech at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/112434] New: unexpected error when compiling for riscv64: invalid 'asm': invalid use of '%c' Date: Wed, 08 Nov 2023 02:28:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rsworktech at outlook dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112434 Bug ID: 112434 Summary: unexpected error when compiling for riscv64: invalid 'asm': invalid use of '%c' Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rsworktech at outlook dot com Target Milestone: --- Created attachment 56528 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56528&action=3Dedit Reduced source file When compiling the provided source file, an unexpected error happens: testcase.i: In function 'produce_asm_define': testcase.i:15:3: error: invalid 'asm': invalid use of '%c' 15 | __asm__("# FUNCTION_OFFSET_INSTANCE =3D %c0" | ^~~~~~~ This could be reproduced on riscv64 or x86_64(using a cross compiler) Commandline used for reproduction: On x86_64: riscv64-linux-gnu-gcc -S testcase.i On riscv64: gcc -S testcase.i It is expected that this file could be compiled without error because: 1. On x86_64, the following commandline works fine: gcc -S testcase.i 2. On x86_64, cross compilation to aarch64 works fine: aarch64-linux-gnu-gc= c -S testcase.i 3. On riscv64, the same source file could be compiled by clang: clang -S testcase.i This is also reproducible with gcc 12.3.0. The reduced testcase.i is attached.=