Package: gcc-4.8
Version: 4.8.2-14
Severity: normal
__builtin_frame_address does not work as documented on ARM. For a value
greater or equal to 1 it returns a non null value but the returned
pointer does not seem to match a frame. See the attached testcase. With
tcc and clang it displays "__builtin_frame_address" while with gcc it
first displays "bfa1: %s" and then segfaults if the #if is removed.
Best regards,
Thomas Preud'homme
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: armhf (armv7l)
Kernel: Linux 2.6.38-ac2-ac100 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages gcc-4.8 depends on:
ii binutils 2.24-3
ii cpp-4.8 4.8.2-14
ii gcc-4.8-base 4.8.2-14
ii libc6 2.17-97
ii libcloog-isl4 0.18.1-3
ii libgcc-4.8-dev 4.8.2-14
ii libgmp10 2:5.1.3+dfsg-1
ii libisl10 0.12.1-2
ii libmpc3 1.0.1-1
ii libmpfr4 3.1.2-1
ii zlib1g 1:1.2.8.dfsg-1
Versions of packages gcc-4.8 recommends:
ii libc6-dev 2.17-97
Versions of packages gcc-4.8 suggests:
ii binutils [binutils-gold] 2.24-3
pn gcc-4.8-doc <none>
pn gcc-4.8-locales <none>
pn libasan0-dbg <none>
pn libatomic1-dbg <none>
pn libbacktrace1-dbg <none>
pn libgcc1-dbg <none>
pn libgomp1-dbg <none>
pn libitm1-dbg <none>
pn libquadmath-dbg <none>
pn libtsan0-dbg <none>
-- no debconf information
#include <stdio.h>
#include <stddef.h>
void bfa3(ptrdiff_t str_offset)
{
printf("bfa3: %s\n", (char *)__builtin_frame_address(3) + str_offset);
}
void bfa2(ptrdiff_t str_offset)
{
printf("bfa2: %s\n", (char *)__builtin_frame_address(2) + str_offset);
bfa3(str_offset);
}
void bfa1(ptrdiff_t str_offset)
{
printf("bfa1: %s\n", (char *)__builtin_frame_address(1) + str_offset);
#if defined(__arm__) && !defined(__GNUC__)
bfa2(str_offset);
#endif
}
void builtin_frame_address_test(void)
{
char str[] = "__builtin_frame_address";
char *fp0 = __builtin_frame_address(0);
printf("str: %s\n", str);
bfa1(str-fp0);
}
int main(void)
{
builtin_frame_address_test();
return 0;
}