Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 2140711

Summary: test in orc possibly miscompiled by gcc 12 on aarch64
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: aoliva, dmalcolm, fweimer, jakub, jwakely, law, mcermak, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: aarch64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-25 16:52:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 245418    
Attachments:
Description Flags
preprocessed source none

Description Dan Horák 2022-11-07 17:16:49 UTC
Description of problem:
Looks like gcc 12 miscompiles a test from the orc project on aarch64. This happens with the default -O2 in the project, after switching to -O1 or -O0 (eg. via CFLAGS=-O1 meson ..) all tests are passing. Also it should be a regression from F-35/GCC 11 where the tests were passing with the default flags.

I have identified the problematic source file to be build/testsuite/orcc/orc_test.c which generated during the build. Keeping everything else as is, but adding #pragma GCC optimize("O1") on top of the file makes the tests pass again. The problem is that this file is 18k lines with 10k in main(). Interestingly switching back to -O2 via a #pragma somewhere in the "middle" (line ~5498) keeps the tests passing, moving the #pragma to the top (up 1 function) it fails again.

Seems it is required to use the ninja command (ninja -v test) to recompiled the modified orc_test.c and re-run the tests, probably due some environment setup (paths, ...). I haven't looked at the details yet.


Version-Release number of selected component (if applicable):
gcc-12.2.1-2.fc36.aarch64

How reproducible:
100%

Steps to Reproduce:
1. git clone https://gitlab.freedesktop.org/gstreamer/orc
2. cd orc; mkdir build; cd build
3. meson ..
4. ninja -v all
5. ninja -v test

Actual results:
...
orc_composite_over_n_8888_8888_ca_2d:
    backup function  :   PASSED
    compiled function:   PASSED
cogorc_resample_horiz_1tap:
    backup function  :   PASSED
    compiled function:   COMPILE FAILED
cogorc_resample_horiz_2tap:
    backup function  :   PASSED
    compiled function:   COMPILE FAILED
test_float_constant_1:
    backup function  :   PASSED
    compiled function:   PASSED
...
Summary of Failures:

12/13 orc_test         FAIL            0.27s   exit status 1

Ok:                 12  
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   


Expected results:
all tests pass

Comment 1 Dan Horák 2022-11-07 17:21:48 UTC
Created attachment 1922804 [details]
preprocessed source

command line is
cc -Itestsuite/orcc/orc_test.p -Itestsuite/orcc -I../testsuite/orcc -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -DHAVE_CONFIG_H -fvisibility=hidden -pthread -MD -MQ testsuite/orcc/orc_test.p/meson-generated_.._orc_test.c.o -MF testsuite/orcc/orc_test.p/meson-generated_.._orc_test.c.o.d -o testsuite/orcc/orc_test.p/meson-generated_.._orc_test.c.o -c testsuite/orcc/orc_test.c

Comment 2 Dan Horák 2022-11-07 17:50:18 UTC
building with CFLAGS=-fsanitize=undefined gives the message bellow, but the tests pass ...

[3/119] cc -Iorc/liborc-0.4.so.0.33.0.p -Iorc -I../orc -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -DHAVE_CONFIG_H -fvisibility=hidden -fsanitize=undefined -fPIC -pthread -DORC_ENABLE_UNSTABLE_API -D_GNU_SOURCE -DBUILDING_ORC -MD -MQ orc/liborc-0.4.so.0.33.0.p/orccodemem.c.o -MF orc/liborc-0.4.so.0.33.0.p/orccodemem.c.o.d -o orc/liborc-0.4.so.0.33.0.p/orccodemem.c.o -c ../orc/orccodemem.c
../orc/orccodemem.c: In function ‘orc_code_region_allocate_codemem_dual_map.constprop’:
../orc/orccodemem.c:222:3: warning: null destination pointer [-Wformat-overflow=]
  222 |   sprintf(filename, "%s/orcexec.XXXXXX", dir);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment 3 Jakub Jelinek 2023-02-06 19:21:43 UTC
Sorry for the delay, bisected to https://gcc.gnu.org/r12-4240 which enabled -ftree-vectorize by default at -O2.  The failure reproduces even with latest GCC trunk at -O2, doesn't reproduce with -O2 -fno-tree-vectorize.
r11-1 (i.e. GCC 11 branchpoint) doesn't reproduce it with -O2 -ftree-vectorize though, so I'll bisect where it started.

Comment 4 Jakub Jelinek 2023-02-06 20:22:45 UTC
With -O2 -ftree-vectorize bisected to https://gcc.gnu.org/r11-5160 , will continue tomorrow.

Comment 5 Ben Cotton 2023-04-25 18:10:19 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 6 Ludek Smid 2023-05-25 16:52:33 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.