RX GCC stops with an internal compiler error with -mlra (14.2.0.202607)
RX GCC stops with an internal compiler error with -mlra (14.2.0.202607)
Toolchain: GCC for Renesas RX 14.2.0.202607-GNURX, the macOS package.
rx-elf-gcc (GCC_Build_482d13c99) 14.2.0.202607-GNURX 20240801
The problem
With -mlra at -O1 or higher, the compiler stops on some functions with:
internal compiler error: in update_reg_eliminate, at lra-eliminations.cc:1203
Three small files are at the end of this post. Each one is enough.
rx-elf-gcc -O2 -mlra -c lra-setjmp.c rx-elf-gcc -O2 -mlra -c lra-nested.c rx-elf-g++ -O2 -mlra -c lra-destructor.cpp
lra-setjmp.ccalls__builtin_setjmp.lra-nested.chas a nested function that jumps out to a label of the function around it.lra-destructor.cpphas an object with a destructor and a call that can throw. Atrydoes the same. Exceptions on RX use setjmp and longjmp, so I think this is the first case again.
All three compile without -mlra, and with -mlra at -O0. The C++ one also compiles with -mlra -fno-exceptions.
GCC test suite
These programs of gcc.c-torture/execute stop the compiler the same way with -Os -mlra and with -O2 -mlra:
nestfunc-5, nestfunc-6, pr24135, pr51447, pr60003, pr84521
At -Os, every other program of that directory gave the same result with and without -mlra when I ran them in the simulator.
I do not have a fix for this one. Is -mlra meant to work on RX in this release?
lra-setjmp.c
void *buffer[5];
void work(int *);
int guarded(void)
{
volatile int state = 0;
if (__builtin_setjmp(buffer))
return state;
state = 1;
work((int *)&state);
return 2;
}
lra-nested.c
int leave_early(int n)
{
__label__ out;
void inner(void) { if (n) goto out; }
inner();
return 0;
out:
return 1;
}
lra-destructor.cpp
struct Guard { Guard(); ~Guard(); int value; };
void use(Guard &);
int scoped()
{
Guard guard;
use(guard);
return guard.value;
}
×

日本語
Hello,
Thank you for your detailed report and for providing the minimal reproducible examples.
Regarding your question, although the -mlra option is accepted by the RX compiler in the current release, it is not covered by our existing regression testing and validation procedures. We cannot therefore recommend its use in production environments, at this time.
A potential fix may be considered for inclusion in a future release. However, this has not yet been confirmed, and no release timeline is currently available. We therefore advise against making development or production plans that depend on the availability of this fix.
We will keep you informed of any relevant developments.
Best regards,
The Open Source Tools Team