Bug 2336256 - R fails to build with GCC 15 (C23 noreturn issues?)
Summary: R fails to build with GCC 15 (C23 noreturn issues?)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: R
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: gcc-15-mass-prebuild
TreeView+ depends on / blocked
 
Reported: 2025-01-07 22:03 UTC by Dave Malcolm
Modified: 2025-01-15 21:45 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-01-15 21:29:07 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Malcolm 2025-01-07 22:03:17 UTC
I'm experimentally rebuilding rawhide with the not-yet-released GCC 15 to see if anything breaks, and to help write the porting guide.  See https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15

My test build with GCC 15 failed:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed/build/8476046/

whereas my test build with GCC 14 succeeded:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed.checker/build/8477596/

Looking at the failure logs e.g.
https://download.copr.fedorainfracloud.org/results/dmalcolm/gcc-15-smoketest-3.failed/fedora-rawhide-x86_64/08476046-R/builder-live.log.gz

I see:

sys-std.c:1189:1: warning: 'noreturn' attribute ignored [-Wattributes]
 1189 | void Rstd_CleanUp(SA_TYPE saveact, int status, int runLast)
      | ^~~~
sys-std.c:1189:1: error: expected identifier or '(' before 'void'

I'm not yet sure what's causing this; possibly due to the change of default to C23 ?

Reproducible: Always

Comment 1 Dave Malcolm 2025-01-07 22:07:12 UTC
Looking at https://svn.r-project.org/R/trunk/src/unix/sys-std.c
the context seems to be:

/*
   R_CleanUp is invoked at the end of the session to give the user the
   option of saving their data.
   If ask == SA_SAVEASK the user should be asked if possible (and this
   option should not occur in non-interactive use).
   If ask = SA_SAVE or SA_NOSAVE the decision is known.
   If ask = SA_DEFAULT use the SaveAction set at startup.
   In all these cases run .Last() unless quitting is cancelled.
   If ask = SA_SUICIDE, no save, no .Last, possibly other things.
 */

attribute_hidden NORET
void Rstd_CleanUp(SA_TYPE saveact, int status, int runLast)
{

Comment 2 Dave Malcolm 2025-01-07 22:10:24 UTC
I'm guessing that "attribute_hidden" is defined in 
https://svn.r-project.org/R/trunk/src/include/Defn.h

which has:

#ifdef HAVE_VISIBILITY_ATTRIBUTE
# define attribute_visible __attribute__ ((visibility ("default")))
# define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
# define attribute_visible
# define attribute_hidden
#endif

but I wasn't able to find a definition of "NORET".  Or maybe something else is going wrong.

Comment 3 Iñaki Ucar 2025-01-08 09:57:20 UTC
Upstream is aware of this AFAICT (see e.g. https://github.com/search?q=repo%3Awch%2Fr-source%20gcc%2015&type=code). So they will likely solve this in the next release.

Comment 4 Jakub Jelinek 2025-01-09 17:32:49 UTC
I think GCC in this spot only handles C23 attributes before GNU attributes, not the other way around, so
NORET attribute_hidden
void Rstd_CleanUp(SA_TYPE saveact, int status, int runLast)
{
would be ok but
attribute_hidden NORET
void Rstd_CleanUp(SA_TYPE saveact, int status, int runLast)
{
is not.

Comment 5 Iñaki Ucar 2025-01-15 21:29:07 UTC
And isn't this a GCC issue? Anyway, upstream provided a patch for now. Closing here.

Comment 6 Jakub Jelinek 2025-01-15 21:45:58 UTC
As clarified by C FE maintainer, it is intentional that way.  __attribute__ is a GNU extension and its placement is generally more forgiving, while the C23 standard clearly specifies where in the grammar they can appear and what they appertain to in each of those cases.


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