[Bug 1340250] [NEW] "#pragma weak" symbol is 0 even when defined

Paul Eggert 1340250 at bugs.launchpad.net
Thu Jul 10 15:08:14 UTC 2014


Public bug reported:

This compiler bug is making the gnulib tests dump core; see:

http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00039.html

Compile and run the following program t.c with the shell commands "gcc
u.c -lm; ./a.out; echo $?"

#include <math.h>
#pragma weak tgamma

int
main (void)
{
  if (!tgamma)
    return 2;
  if (tgamma (1) == 1)
    return 0;
  return 1;
}

The program will exit with status 2.  It should exit with status 0,
because the math library does have a tgamma function and the function
pointer should be non-null.

I observe this problem with Ubuntu 14.04 x86-64 (GCC Ubuntu
4.8.2-19ubuntu1), but not on Fedora 20 or on RHEL 6.5.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: gcc 4:4.8.2-1ubuntu6
ProcVersionSignature: Ubuntu 3.13.0-30.55-generic 3.13.11.2
Uname: Linux 3.13.0-30-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.2
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Jul 10 07:39:11 2014
InstallationDate: Installed on 2012-12-21 (566 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to trusty on 2014-04-18 (83 days ago)

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


** Tags: amd64 apport-bug trusty

** Attachment added: "test program illustrating the bug; compile with "gcc t.c -lm""
   https://bugs.launchpad.net/bugs/1340250/+attachment/4149659/+files/t.c

-- 
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/1340250

Title:
  "#pragma weak" symbol is 0 even when defined

Status in “gcc-defaults” package in Ubuntu:
  New

Bug description:
  This compiler bug is making the gnulib tests dump core; see:

  http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00039.html

  Compile and run the following program t.c with the shell commands "gcc
  u.c -lm; ./a.out; echo $?"

  #include <math.h>
  #pragma weak tgamma

  int
  main (void)
  {
    if (!tgamma)
      return 2;
    if (tgamma (1) == 1)
      return 0;
    return 1;
  }

  The program will exit with status 2.  It should exit with status 0,
  because the math library does have a tgamma function and the function
  pointer should be non-null.

  I observe this problem with Ubuntu 14.04 x86-64 (GCC Ubuntu
  4.8.2-19ubuntu1), but not on Fedora 20 or on RHEL 6.5.

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: gcc 4:4.8.2-1ubuntu6
  ProcVersionSignature: Ubuntu 3.13.0-30.55-generic 3.13.11.2
  Uname: Linux 3.13.0-30-generic x86_64
  ApportVersion: 2.14.1-0ubuntu3.2
  Architecture: amd64
  CurrentDesktop: Unity
  Date: Thu Jul 10 07:39:11 2014
  InstallationDate: Installed on 2012-12-21 (566 days ago)
  InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
  SourcePackage: gcc-defaults
  UpgradeStatus: Upgraded to trusty on 2014-04-18 (83 days ago)

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



More information about the foundations-bugs mailing list