Re: [Rd] Does R use "computed gotos" - a gcc extension of C?

From: Dr. David Kirkby <>
Date: Sat, 05 Mar 2011 21:02:01 +0000

On 03/ 4/11 11:40 PM, wrote:
> On Fri, 4 Mar 2011, Dr. David Kirkby wrote:
>> The R manual says R will not build with gcc on 64-bit Solaris x86 with
>> gcc
>> "Tests with gcc32 on ‘x86’ and ‘amd64’ have been less successful:
>> ‘x86’ builds have failed on tests using complex arithmetic33, whereas
>> on ‘amd64’ the builds have failed to complete in several different
>> ways, most recently with relocation errors for "
>> I know what the "relocation errors" problem is. That library (and in
>> fact two other R libraries) all have non-PIC code in them, despite the
>> fact the source is compiled with the -fPIC option.
>> shows how to prove this. If one runs this command on Solaris:
>> $ elfdump -d | fgrep TEXTREL
>> there is some output showing that theres non-PIC code present in the R
>> library.
>> R is compiled with -fPIC on Solaris, but certain things can cause
>> non-PIC code to be generated even with that option. One is by the use
>> of "computed gotos" which is a gcc extension. I'm wondering if R uses
>> any of these.
> Yes -- in the byte code interpreter in eval.c
> luke

Thank you Luke. Do you know if there may be any others?

Do you know if that bit of code gets compiled into all 3 of the R libraries? I tried replacing

#define NEXT() (__extension__ ({goto *(*pc++).v;}))

by a function which did absolutely nothing. The code built, but still had the library issues.

I'm almost certain that the definition of NEXT will cause problems, but I'm not convinced it is the only issue.

What happens if a non-GNU compiler is used? I assume these GNU extensions don't get used, so how comes the code builds? Is there any way I can disable the use of the GNU extensions, while still building with gcc.

It is rather annoying that the code has __extension__ in it, which disables the warnings about the use of GCC extensions.

6qlink5">name="0486qlink5"> name="0486qlink5"><a name="0486qlink5">ame="0486qlink5">name="0486qlink5"> name="0486qlink5">W>hy iname="0486qlink4">s th name="0486qlink4">ere <a name="0486qlink4">a need to hide the use of the extensions? I'd personally like to see just standard C used, without any extensions. Then problems like I'm having would be less likely to occur.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


______________________________________________ mailing list
Received on Sat 05 Mar 2011 - 21:06:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 05 Mar 2011 - 22:20:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive