Bug 99220

Summary: __builtin_return_address may not work on ia64
Product: [Retired] Red Hat Raw Hide Reporter: hjl
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2.3-14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-02 18:08:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description hjl 2003-07-16 00:39:33 UTC
# cat x.c
#include <stdio.h>
 
int
main()
{
  int addr;
 
  addr = __builtin_return_address (0);
 
  printf("%d\n", addr);
  return 0;
}

# /usr/gcc-3.4/bin/gcc -O x.c
x.c: In function `main':
x.c:8: warning: assignment makes integer from pointer without a cast
/tmp/ccoJdxcc.o(.text+0x11): In function `main':
: undefined reference to `retaddr'
collect2: ld returned 1 exit status

Comment 1 hjl 2003-07-16 16:27:24 UTC
Another related bug:

[hjl@gnu-2 tmp]$ cat x.c
#include <stdio.h>
  
int
main()
{
  int addr [10];
 
  addr [0] = (int) __builtin_return_address (0);
  
  printf("%d\n", addr [0]);
  return 0;
}
[hjl@gnu-2 tmp]$ gcc -c x.c -O
x.c: In function `main':
x.c:8: warning: cast from pointer to integer of different size
/tmp/ccQZPp9G.s: Assembler messages:
/tmp/ccQZPp9G.s:23: Error: Operand 2 of `st4' should be a general register



Comment 2 Jakub Jelinek 2003-08-05 14:49:30 UTC
Richard's http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00283.html
should fix it.
I'll wait till it is applied to the trunk and apply it to our gcc branches too
(maybe without the removal of the no longer used virtual register to keep the
changes smaller).