Repository: spack/spack

Issue:
Installation issue: util-linux-uuid@2.37.4 fails with all tested intel compilers.
### Steps to reproduce the issue

```console
$spack spec util-linux-uuid@2.37.4%intel
Input spec
--------------------------------
util-linux-uuid@2.37.4%intel

Concretized
--------------------------------
util-linux-uuid@2.37.4%intel@2021.6.0 arch=linux-rhel7-cascadelake
    ^pkgconf@1.8.0%intel@2021.6.0 arch=linux-rhel7-cascadelake
$ spack install util-linux-uuid@2.37.4%intel
...
```


### Error message

<details><summary>Error message</summary><pre>

609    libtool: compile:  /dev/shm/spack/lib/spack/env/intel/icc -DHAVE_CONFIG_H -I. -I/var/tmp/lemuel/spack-stage/spack-stage-util-linu
            x-uuid-2.37.4-5aanwtorscvsoe47z5cns577rpaxpqw7/spack-src -include config.h -I/var/tmp/lemuel/spack-stage/spack-stage-util-linux-u
            uid-2.37.4-5aanwtorscvsoe47z5cns577rpaxpqw7/spack-src/include -DLOCALEDIR=\"/dev/shm/spack/opt/spack/linux-rhel7-cascadelake/inte
            l-2021.6.0/util-linux-uuid-2.37.4-5aanwtorscvsoe47z5cns577rpaxpqw7/share/locale\" -D_PATH_RUNSTATEDIR=\"/dev/shm/spack/opt/spack/
            linux-rhel7-cascadelake/intel-2021.6.0/util-linux-uuid-2.37.4-5aanwtorscvsoe47z5cns577rpaxpqw7/var/run\" -D_PATH_SYSCONFSTATICDIR
            =\"/dev/shm/spack/opt/spack/linux-rhel7-cascadelake/intel-2021.6.0/util-linux-uuid-2.37.4-5aanwtorscvsoe47z5cns577rpaxpqw7/lib\" 
            -fsigned-char -fno-common -Wall -Wextra -Wformat-security -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-protot
            ypes -Wno-missing-field-initializers -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wtype-limits -Wuninitialized -Wunused-bu
            t-set-parameter -Wunused-but-set-variable -Wunused-parameter -Wunused-variable -Werror=sequence-point -I/var/tmp/lemuel/spack-sta
            ge/spack-stage-util-linux-uuid-2.37.4-5aanwtorscvsoe47z5cns577rpaxpqw7/spack-src/libuuid/src -Ilibuuid/src -g -O2 -MT lib/libuuid
            _la-md5.lo -MD -MP -MF lib/.deps/libuuid_la-md5.Tpo -c lib/md5.c  -fPIC -DPIC -o lib/.libs/libuuid_la-md5.o
  >> 610    libuuid/src/unparse.c(42): error: expected a ")"
     611      static void uuid_fmt(const uuid_t uuid, char *buf, char const *restrict fmt)
     612                                                                              ^
     613    
  >> 614    libuuid/src/unparse.c(52): error: identifier "fmt" is undefined
     615      		*p++ = fmt[tmp >> 4];
     616      		       ^
     617    
     618    libuuid/src/unparse.c(42): warning #869: parameter "restrict" was never referenced
     619      static void uuid_fmt(const uuid_t uuid, char *buf, char const *restrict fmt)
     620                                                                     ^
     621   

</pre></details> 


### Information on your system

* **Spack:** 0.19.0.dev0 (bb1156f9d4f2dfcb2cf2c770cbec1c673db2292a)
* **Python:** 3.7.2
* **Platform:** linux-rhel7-cascadelake
* **Concretizer:** clingo

### Additional information

[spack-build-out.txt](https://github.com/spack/spack/files/8895070/spack-build-out.txt)
[spack-build-env.txt](https://github.com/spack/spack/files/8895073/spack-build-env.txt)

Intel compiler versions tested that failed:
intel@2021.6.0
intel@2021.5.0
intel@2021.4.0
intel@2021.3.0
intel@2021.2.0
intel@19.1.2.254
intel@19.0.4.227
intel@18.0.2

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
This may be a manifestation of #31255.

Looking into this a bit more deeply:

util-linux-uuid@2.37.4 (but not 2.36.2 or 2.36) triggers an error handling the `restrict` type quantifier when compiled with Intel compilers from version 14 through 19*.  The Intel OneAPI compilers handle the `restrict` type quantifier correctly.

Compilations succeeds after adding `CFLAGS=-restrict`.  Adding that flag does not cause additional issues for previously-working builds.

PR shortly.

* Tested Intel compiler versions:  14.0.3, 15.0.6, 16.0.4, 17.0.2, 18.0.2, 19.1.2.254.  Tested OneAPI compiler versions:  2021.2.0, 2022.1.0. 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/util-linux-uuid/package.py b/var/spack/repos/builtin/packages/util-linux-uuid/package.py
--- a/var/spack/repos/builtin/packages/util-linux-uuid/package.py
+++ b/var/spack/repos/builtin/packages/util-linux-uuid/package.py
@@ -46,4 +46,7 @@ def configure_args(self):
             '--enable-libuuid',
             '--disable-bash-completion',
         ]
+        # Fixes #31123.
+        if self.spec.satisfies('%intel'):
+            config_args.append('CFLAGS=-restrict')
         return config_args


Test patch: