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

Dr. David Kirkby david.kirkby at onetel.net
Sat Mar 5 23:06:44 CET 2011


On 03/ 5/11 09:31 PM, luke-tierney at uiowa.edu wrote:
> On Sat, 5 Mar 2011, Dr. David Kirkby wrote:

>>> Yes -- in the byte code interpreter in eval.c
>>>
>>> luke
>>
>> Thank you Luke. Do you know if there may be any others?
>
> I do not.
>
>> Do you know if that bit of code gets compiled into all 3 of the R
>> libraries? I tried replacing
>
> I do not know
>
>> #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.
>
> This particular bit It only uses the gcc extensions for gcc compilers,
> and this can be turned off by defining NO_THREADED_CODE.

Does that have a significant impact on performance? I would normally associate 
"threaded" with meaning doing things in parallel.

Could that be defined when compiling just this one file, or should it be done 
when building the whole of R?

>> It is rather annoying that the code has __extension__ in it, which
>> disables the warnings about the use of GCC extensions.
>>
>> http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
>>
>> Why is there a need to hide the use of the extensions?
>
> To avoid spurious warnings


>> 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.
>
> This extention is very useful for implementing byte code interpreters,
> which is why it is being used. As mentioned above, its use can be
> turned off.

If this does solve the Solaris problem, that would be worth mentioning in the R 
installation guide. I'll let you know of the result of that.

> luke

Thank you for your help Luke.

-- 
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?

Dave



More information about the R-devel mailing list