Bug 39824 - gcc generates call to non-existent runtime function
gcc generates call to non-existent runtime function
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-05-09 04:48 EDT by j. alan eldridge
Modified: 2007-04-18 12:33 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-05-09 05:51:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description j. alan eldridge 2001-05-09 04:48:27 EDT
Description of Problem:

Call the library function strcpy() with a source string of 4 chars or 
less, and compile with -O2 -fno-inline. GCC generates a call to 
__strcpy_small which does not exist.

How Reproducible:

[alane@wwweasel alane]$ rpm -q gcc
gcc-2.96-81
[alane@wwweasel alane]$ cat > urk.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef unix
#include <unistd.h>
#endif /* unix */
 
int
main()
{
  char *s;
 
  s=malloc(10);
  strcpy(s,"X");
  puts(s);
  return 0;
}
[alane@wwweasel alane]$ gcc -O2 -fno-inline -o urk urk.c
/tmp/ccCKE1op.o: In function `main':
/tmp/ccCKE1op.o(.text+0x77): undefined reference to `__strcpy_small'
collect2: ld returned 1 exit status
[alane@wwweasel alane]$ gcc -O2 -fno-inline -c urk.c
[alane@wwweasel alane]$ nm urk.o
         U __strcpy_small
00000000 t gcc2_compiled.
00000000 T main
         U malloc
         U puts
Comment 1 Jakub Jelinek 2001-05-09 05:51:11 EDT
I'm aware of this, have solved it already - see
http://gcc.gnu.org/ml/gcc-patches/2001-05//msg00275.html
http://sources.redhat.com/ml/libc-hacker/2001-05/msg00003.html
These patches will appear in gcc-2.96-85 and glibc-2.2.3-6 respectively.
Comment 2 Need Real Name 2001-09-04 00:02:24 EDT
I have the Red Hat 7.1 installed on my computer, and I had a little problem 
with the gcc compiler.
Please, I would like, if possible, of obtaining an answer for the following 
question: Why the simple source code below when compiled using the gcc (gcc 
test.c -o test) it generates the following message:  undefined reference to 
`sqrt' ?
(all the libraries are installed!!!)


/*Program Test*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main (void)
{
  int i;
  float s;

  for (i = 0 ; i <= 10 ; i++){
	s = sqrt(i);
 	printf("\n sqrt(%d) = %f", i , s);
  }

}


Thank you.


lederman@numec.ufjf.br

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