[Bug 2095225] [NEW] Incorrect warning about ignoring attribute gnu_inline

Jerome Abela 2095225 at bugs.launchpad.net
Sat Jan 18 10:44:14 UTC 2025


Public bug reported:

When compiling the following file:

#include <stdio.h>
extern inline __attribute__((gnu_inline)) FILE *fopen(const char *filename, const char *mode) {
    return NULL;
}

GCC produces the following warning:

bug.c:2:1: warning: ignoring attribute ‘gnu_inline’ because it conflicts with attribute ‘noinline’ [-Wattributes]
    2 | extern inline __attribute__((gnu_inline)) FILE *fopen(const char *filename, const char *mode) {
      | ^~~~~~

However, compiling with -E shows that the stdio declaration doesn't have
a noinline attribute:

extern FILE *fopen (const char *__restrict __filename,
      const char *__restrict __modes)
  __attribute__ ((__malloc__)) __attribute__ ((__malloc__ (fclose, 1))) ;

At best, the warning is giving an incorrect reason. At worst, it's
ignoring a valid gnu_inline attribute.

I tried with --no-builtin as well, in case there is a hidden builtin
declaration, but the message is the same.

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: gcc 4:13.2.0-7ubuntu1
ProcVersionSignature: Ubuntu 6.8.0-51.52-generic 6.8.12
Uname: Linux 6.8.0-51-generic x86_64
ApportVersion: 2.28.1-0ubuntu3.3
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Sat Jan 18 10:37:31 2025
InstallationDate: Installed on 2024-07-01 (201 days ago)
InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Release amd64 (20240424)
SourcePackage: gcc-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: gcc-defaults (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug noble wayland-session

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/2095225

Title:
  Incorrect warning about ignoring attribute gnu_inline

Status in gcc-defaults package in Ubuntu:
  New

Bug description:
  When compiling the following file:

  #include <stdio.h>
  extern inline __attribute__((gnu_inline)) FILE *fopen(const char *filename, const char *mode) {
      return NULL;
  }

  GCC produces the following warning:

  bug.c:2:1: warning: ignoring attribute ‘gnu_inline’ because it conflicts with attribute ‘noinline’ [-Wattributes]
      2 | extern inline __attribute__((gnu_inline)) FILE *fopen(const char *filename, const char *mode) {
        | ^~~~~~

  However, compiling with -E shows that the stdio declaration doesn't
  have a noinline attribute:

  extern FILE *fopen (const char *__restrict __filename,
        const char *__restrict __modes)
    __attribute__ ((__malloc__)) __attribute__ ((__malloc__ (fclose, 1))) ;

  At best, the warning is giving an incorrect reason. At worst, it's
  ignoring a valid gnu_inline attribute.

  I tried with --no-builtin as well, in case there is a hidden builtin
  declaration, but the message is the same.

  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: gcc 4:13.2.0-7ubuntu1
  ProcVersionSignature: Ubuntu 6.8.0-51.52-generic 6.8.12
  Uname: Linux 6.8.0-51-generic x86_64
  ApportVersion: 2.28.1-0ubuntu3.3
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Sat Jan 18 10:37:31 2025
  InstallationDate: Installed on 2024-07-01 (201 days ago)
  InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Release amd64 (20240424)
  SourcePackage: gcc-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/2095225/+subscriptions




More information about the foundations-bugs mailing list