Bug 2160275

Summary: ccache changes order or compiler arguments
Product: [Fedora] Fedora Reporter: Siddhesh Poyarekar <sipoyare>
Component: ccacheAssignee: Michael Cullen <michael>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 38CC: davide, mcatanza, michael, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ccache-4.8.2-1.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-22 01:21:58 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: 2180670    
Bug Blocks:    

Description Siddhesh Poyarekar 2023-01-11 23:43:27 UTC
Description of problem:
ccache changes the order of arguments passed to the compiler, thus potentially changing the compiled output.

Version-Release number of selected component (if applicable):
ccache-4.7.4-1.fc38.x86_64

How reproducible:
Always

Steps to Reproduce:
1. cat > foo.c
#if _FORTIFY_SOURCE == 0
# warning "_FORTIFY_SOURCE is 0"
#else
# warning "_FORTIFY_SOURCE is non-zero"
#endif
unsigned foo;


2. ccache g++  -O2 -flto=auto -grecord-gcc-switches -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -o foo.o -c foo.c


Actual results:

foo.c:4:3: warning: #warning "_FORTIFY_SOURCE is non-zero" [-Wcpp]
    4 | # warning "_FORTIFY_SOURCE is non-zero"
      |   ^~~~~~~

Expected results:

foo.c: warning: -D_FORTIFY_SOURCE defined but value is too low
foo.c:2:3: warning: #warning "_FORTIFY_SOURCE is 0" [-Wcpp]
    2 | # warning "_FORTIFY_SOURCE is 0"
      |   ^~~~~~~

Comment 1 Orion Poplawski 2023-01-12 01:40:37 UTC
Can you file this upstream at https://github.com/ccache/ccache/issues ?  Thanks.

Comment 2 Siddhesh Poyarekar 2023-01-12 12:51:33 UTC
Here you go: https://github.com/ccache/ccache/issues/1238

Comment 3 Ben Cotton 2023-02-07 15:05:16 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 4 Orion Poplawski 2023-04-06 03:19:10 UTC
Should be fixed in ccache-4.8-1.fc39.  Testing to see if we have a new enough gcc to build for f38.

Comment 5 Fedora Update System 2023-07-17 01:45:42 UTC
FEDORA-2023-f80c64bf54 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-f80c64bf54

Comment 6 Fedora Update System 2023-07-18 01:26:02 UTC
FEDORA-2023-f80c64bf54 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-f80c64bf54`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-f80c64bf54

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2023-07-22 01:21:58 UTC
FEDORA-2023-f80c64bf54 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.