Skip to content

[clang] code generation issue with clang -march=amdfam10 #89008

Open
@tonycoz

Description

@tonycoz

This was originally reported against perl as Perl/perl5#22132 but appears to be a clang issue.

Reduced test case (as opposed to the perl source):
22132.txt (.txt since github didn't like .c)

This was originally reported against clang 17.0.6 as supplied with FreeBSD 13.3, but was reproducible on Debian Linux bookworm with the clang/llvm builds from apt.llvm.org since clang 15.

$ clang-14 -O2 -march=amdfam10 22132.c && ./a.out required_even_ix $ clang-15 -O2 -march=amdfam10 22132.c && ./a.out requiredEven_ix $ clang-16 -O2 -march=amdfam10 22132.c && ./a.out requiredEven_ix $ clang-17 -O2 -march=amdfam10 22132.c && ./a.out requiredEven_ix $ clang-18 -O2 -march=amdfam10 22132.c && ./a.out requiredEven_ix $ clang-18 -O2 -march=amdfam10 22132.c && ./a.out | hd 00000000 72 65 71 75 69 72 65 64 7f 45 76 65 6e 5f 69 78 |required.Even_ix| 00000010 0a |.| 00000011 $ clang-18 -O2 22132.c && ./a.out required_even_ix $ clang-18 -O2 -march=x86-64-v2 22132.c && ./a.out required_even_ix $ clang-18 --version Debian clang version 18.1.4 (++20240410110204+b6ebea7972cd-1~exp1~20240410230232.97) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin $ clang-17 --version Debian clang version 17.0.6 (++20231208085813+6009708b4367-1~exp1~20231208085906.81) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin $ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" $ clang-18 -O2 -fsanitize=address 22132.c && ./a.out required_even_ix $ clang-18 -O2 -fsanitize=undefined 22132.c && ./a.out required_even_ix 

Metadata

Metadata

Assignees

No one assigned

    Labels

    clangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close