Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 163473

Summary: ceil - incorrect undefined reference error
Product: [Fedora] Fedora Reporter: Patrick <rh_bugzilla>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: byte
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-07-18 08:24:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Patrick 2005-07-18 00:01:46 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4

Description of problem:
According to bytee in #fedora-ppc ceil(2.0/4.0) and ceil(.4) work correctly.
But if you say double c=.4; and did ceil(c), it would fail stating ceil.c:8: undefined reference to `ceil'. 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Get ztclock.c from
2. gcc -I. -O3 -g -Wall ./ztclock.c -o ./ztclock

Actual Results:  /tmp/ccO1s5dm.o(.text+0x1a4): In function `main':
./ztclock.c:52: undefined reference to `ceilf'
collect2: ld returned 1 exit status

Expected Results:  Successful compilation.

Additional info:

If I remove the -O3 and compile I get:
/tmp/ccEzptmb.o(.text+0x2b8): In function `main':
./ztclock.c:52: undefined reference to `ceil'
collect2: ld returned 1 exit status
Note the search for "ceil" and not "ceilf"

If I compile with -lm the compilation is successful:
gcc -lm -I. -O3 -g -Wall ./ztclock.c -o ./ztclock

Comment 1 Jakub Jelinek 2005-07-18 08:24:31 UTC
And the bug is where?  -lm of course must be used when you use functions
implemented in libm.  Also, please learn to place libraries last on the command
line, otherwise things don't work very well at least when statically linking
or using nonshared auxiliary libraries (e.g. -lc or -lpthread have such aux
libs, -lm ATM doesn't, but that could change).