Bug 1943738 - clang 12 with %{build_cflags} armv7hl: segmentation fault
Summary: clang 12 with %{build_cflags} armv7hl: segmentation fault
Keywords:
Status: CLOSED DUPLICATE of bug 1918924
Alias: None
Product: Fedora
Classification: Fedora
Component: clang
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom Stellard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-26 23:55 UTC by Jun Aruga
Modified: 2021-04-14 04:48 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-04-10 00:54:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
root.log (101.91 KB, text/plain)
2021-03-26 23:58 UTC, Jun Aruga
no flags Details
build.log (3.88 KB, text/plain)
2021-03-26 23:58 UTC, Jun Aruga
no flags Details

Description Jun Aruga 2021-03-26 23:55:41 UTC
Description of problem:

The clang 12.0.0-0.7.rc3.fc35 armv7hl has segmentation fault.

On a simple spec file to build with %{build_cflags} flags,

```
cat > test.c <<EOF
int main(void) {
    return 0;
}
EOF

%global toolchain clang
clang test.c -o test %{build_cflags}
```

I see the segmentation fault on armv7hl.

```
+ clang test.c -o test -O2 -flto -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard
clang-12: error: unable to execute command: Segmentation fault (core dumped)
clang-12: error: linker command failed due to signal (use -v to see invocation)
```

Version-Release number of selected component (if applicable):
clang-12.0.0-0.7.rc3.fc35

How reproducible:

I prepared the reproducer here.
https://github.com/junaruga/report-clang-12-with-flags-arm32-error

Steps to Reproduce:
1. git clone https://github.com/junaruga/report-clang-12-with-flags-arm32-error.git
2. cd report-clang-12-with-flags-arm32-error 
3. fedpkg --release rawhide srpm
4. koji build --scratch --nowait rawhide test-1-1.fc35.src.rpm
5. See the result armv7hl https://koji.fedoraproject.org/koji/taskinfo?taskID=64660466 .

Actual results:
clang-12: error: unable to execute command: Segmentation fault (core dumped)

Expected results:
The build finishes without error.

Additional info:

I think adding a simple test to test `%global toolchain clang` + `%{build_cflags}` to %check section in clang.spec could be good to avoid this in the future if `clang.spec` does not have it.

Comment 1 Jun Aruga 2021-03-26 23:58:06 UTC
Created attachment 1766803 [details]
root.log

Comment 2 Jun Aruga 2021-03-26 23:58:31 UTC
Created attachment 1766804 [details]
build.log

Comment 3 Tom Stellard 2021-04-10 00:54:35 UTC

*** This bug has been marked as a duplicate of bug 1918924 ***

Comment 4 Jun Aruga 2021-04-14 04:48:43 UTC
Thanks! I was able to avoid this issue by following this way.
https://bugzilla.redhat.com/show_bug.cgi?id=1918924#c3

I checked the ticket 1918924 when I checked clang's current issues at that time. But I misunderstand I already set `%global _lto_cflags %{nil}` for my spec file.
So, I thought it might be different issue from the ticket.


Note You need to log in before you can comment on or make changes to this bug.