Bug 39824 - gcc generates call to non-existent runtime function
Summary: gcc generates call to non-existent runtime function
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.1
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-05-09 08:48 UTC by j. alan eldridge
Modified: 2007-04-18 16:33 UTC (History)
0 users

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


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2001:082 high SHIPPED_LIVE New version of GCC 2.96-RH available fixing several bugs 2001-06-14 04:00:00 UTC

Description j. alan eldridge 2001-05-09 08:48:27 UTC
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 09:51:11 UTC
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 04:02:24 UTC
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.