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 - ceil - incorrect undefined reference error
Summary: ceil - incorrect undefined reference error
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-07-18 00:01 UTC by Patrick
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-07-18 08:24:31 UTC

Attachments (Terms of Use)

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).

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