intel / intel/confidential-computing.sgx

CC compiler minor version extraction is broken

Open
#1,076 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.5k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

The top level `buildenv.mk` file extracts the compiler version as follows:

```
CC_VERSION := $(shell $(CC) -dumpversion)
CC_VERSION_MAJOR := $(shell echo $(CC_VERSION) | cut -f1 -d.)
CC_VERSION_MINOR := $(shell echo $(CC_VERSION) | cut -f2 -d.)
```

This logic only works if '-dumpversion' prints a multi-digit version string, but at some point GCC has switched to only printing the major version number

eg with gcc-9.3.1 RPM

```
# gcc -dumpversion
9
```

eg with gcc-14.2.1 RPM

```
$ gcc -dumpversion
14
```

This breaks the 'cut' commands above. When the delimiter is NOT present, the field selector has no effect and it will always return the original input string, no matter what field is requested.

IOW, when GCC 14.2.1 RPM, both CC_VERSION_MAJOR and CC_VERSION_MINOR are getting set to '14'.

Fortunately the only comparison that buildenv.mk does with CC_VERSION_MAJOR/MINOR are checking for ancient GCC versions, but this is a latent bug that may hit future conparisons.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.