April 5th, 2007
KPIT Cummins Infosystems Limited is
releasing SH-Linux MMU v0701, a cross compiler tool chain for Renesas SuperH series of microcontrollers with Memory Management Unit (MMU).
SALIENT
FEATURES:
| 1. |
SH-Linux MMU v0701 is based on
gcc-4.2.0, binutils-2.17 and glibc-2.5 using kernel
headers-2.6.12. |
| 2. |
The latest patches have been
applied to the gcc, binutils and glibc sources. |
| 3. |
The default target for the
toolchain is sh4 Little Endian. |
| 4. |
The toolchain is specifically built for Renesas SuperH devices with MMU. |
| 5. |
The toolchain supports Native POSIX Thread Library (NPTL). |
| 6. |
The toolchain has been tested for Linux kernel
version 2.6.20. |
ABOUT
SH-Linux MMU v0701:
| Release version: |
SH-Linux MMU v0701 |
| Platforms Supported: |
Red Hat GNU/Linux v6.0 or
later (or compatible distribution) (RedHat9, Fedora Core 2, Fedora
Core 3, Fedora Core 4, Fedora Core 5 and Fedora Core 6) |
| Languages: |
C, C++ |
| SH Series: |
SH-3,
SH-3E,
SH3-DSP, SH-4, SH-4A, SH-4AL-DSP |
| Object File Formats: |
ELF |
Please register at http://www.kpitgnutools.com/ for
free technical support. Please contact http://www.kpitgnutools.com/feedback.php
for any feedback or suggestions. |
CHANGES IN THIS
RELEASE:
| 1. The following test case generated incorrect assembly code when compiled
using optimization '-O2' with 'sh4-linux-gcc
-ml -m4 -O2 -fomit-frame-pointer -S testcode.c -o a.s' command. int func
(void)
{
int
error;
if (foo3 ())
{
foo4(0, 1, 2, "abc", 310,
foo1());
return
(990);
}
if ((error = foo2 ()))
{
return
error;
}
foo4(0, 1, 2, "abc", 352,
foo1());
return
(990);
}
This bug has been fixed in 0701
release.
|
| 2. The code which accessed thread libraries generated
incompatible library error at compilation time.
This bug has been fixed in 0701 release.
|
3. Following code caused Internal Compiler Error,
const int i = 1;
void foo ()
{
char a[][i] = {""};
}
This bug has been fixed in 0701
release.
|
4. Following code caused Internal Compiler Error,
int main(int ac, char** av)
{
int
to[6] = (int[6]){-1,-1,-1,-1,-1,-1};
return 0;
}
This bug has been fixed in 0701
release.
|
5. Following code caused Internal Compiler Error
when compiled using optimization option '-O1' and above,
typedef float V2SF __attribute__ ((vector_size (8)));
int test0 (V2SF, V2SF);
int
main (void)
{
V2SF a = (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f -
1.0f/0.0f};
V2SF b = (V2SF) {567.345, 1984.0};
int i;
i = test0 (a, b);
return i;
}
This bug has been fixed in 0701
release.
|
6. Following code caused Internal Compiler Error
when compiled using with or without optimization option,
typedef float floatvect2 __attribute__((mode(V2SF)));
typedef union
{
floatvect2 vector;
float f[2];
}resfloatvect2;
void tempf(float *x, float *y)
{
floatvect2 temp={x[0],x[1]};
floatvect2 temp1={y[0],y[1]};
resfloatvect2 temp2;
temp2.vector=temp+temp1;
x[0]=temp2.f[0];
x[1]=temp2.f[1];
}
This bug has been fixed in 0701
release.
|
|
7. Following packages generated
Segmentation Fault when compiled using optimization option '-O2' and above,
a. Procps-3.2.5
b. Vim-6.3
c. E2fsprogs-1.38
This bug has been fixed in 0701 release.
|
|
8. Following code caused Internal Compiler Error when compiled using
optimization option '-O2',
#include <limits.h>
int i;
int main()
{
signed int a08;
struct tag1 {
int b01:10;
}tag1;
a08=INT_MAX;
tag1.b01=CHAR_MAX;
i=tag1.b01>>a08;
}
This bug has been fixed in 0701 release.
|
|
9. Following code caused the compiler to hang when compiled using optimization
option '-O2',
Source:
main(){static int a=1;
a++;
a++;
a++;
・・・・ <- "a++;" is processed 65535 times.
}
This bug has been fixed in 0701 release.
|
KNOWN PROBLEMS:
We intend to fix the known problems in our future releases. We
may release Maintenance Packs for critical bugs fixed in between releases.
|
1. Including the header file
inside a function block generates compilation errors when compiled using
optimization '-O2'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
|
| |
|
2. Extern declaration of strcmp
function in the code as shown below,
extern int
strcmp(const char *, const char *);
generates error when compiled
with '-O2' optimization.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' with '-O2'.
|
| |
|
3. The following test case hangs on execution when
compiled
using optimization '-O2' .
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
int y,*p;
void func()
{
while (!y)
*p = 10;
}
main()
{
p = &y;
y = 0;
func();
}
|
| |
|
4. The following test case
generates Segmentation fault on execution when compiled
using optimization '-O2'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
typedef struct lp1{
union{
short ss;
long sl;
}u1;
union{
unsigned short us;
unsigned long ul;
}u2;
}LPTEST;
typedef struct arr{
int a[8];
}ARR;
main()
{
LPTEST l,l2;
ARR b[3];
l.u2.us=3;
l.u1.sl=0;
l2.u1.ss=8;
while (l.u1.sl<l.u2.us){
l.u2.ul=0;
while
(l.u2.ul<l2.u1.ss){
b[l.u1.sl].a[l.u2.ul]=2;
++l.u2.ul;
}
++l.u1.sl;
}
check(&b, 2);
}
check(ARR *st,int val)
{
int i;
for (i=0; i<3; ++i);
} |
|
|
5. The following test case generates
different outputs when compiled
using optimization '-O2' and
'-O0'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2' and '-O0'
main()
{
int i = -1, s = 35 ;
if( (i << s) == 0 ) printf("OK\n") ;
else printf("NOT OK\n") ;
} |
|
|
6. The following test case
generates Segmentation fault on execution when compiled using optimization
'-O2'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
char c2[50];
main()
{
char c1[50] ;
strcpy(c1,
"a123456789b123456789c123456789d123456789e123456789") ;
strcpy(c2, c1) ;
}
For workaround, use switch '-fno-cse-follow-jumps', while
compiling the code. |
|
| 7. The following test case hangs on execution when
compiled using optimization '-O2'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
extern void p049();
main()
{
p049();
}
void p049()
{
int i=-2147483647;
int j=0;
while (i!=2147483637){
i--;
j++;
}
}
For workaround, use switch '-fno-tree-pre', while compiling the
code. |
| |
| 8. The following test case generates compilation
error when compiled using optimization '-O2'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
struct A {
signed int z : 9;
};
template <class T> int f(T)
{
static int x = 0;
return x;
}
int main(void)
{
A a;
int result;
result=f((short)-2);
result=f(a.z);
}
For workaround, use
switches '-fno-implicit-templates' and '-fno-weak', while compiling the
code. |
| |
| 9. The following test case generates compilation
error of 'Segmentation fault (program cc1)' when compiled using optimization
'-O2'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2'
int x4, x5;
main()
{
int i=(int)&x4+(int)&x5+200;
if (i!=0){
i=(int)&x4-(int)&x5;
if (i!=0)
printf("O.K.\n");
}
}
For workaround, use switch
'-fno-gcse', while compiling the code. |
| |
| 10. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2'.
extern void p059();
typedef
struct aaa {
char name[16];
}AAA;
main()
{
int i;
AAA buf[20];
for (i=0; i<20; i++)
buf[i].name[0] = 't';
if (buf[10].name[0] == 't')
printf("OK\n");
else printf("NOT OK\n");
}
For workaround, use switch
'-fno-optimize-sibling-calls', while compiling the code. |
| |
|
11. The following test case
generates different output when compiled
using optimization '-O2' and
'-O0'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2' and '-O0'.
struct {
short a:8, b:8;
}
c01,c02,c03,c04;
main(void)
{
void *ps;
short *p;
c01.a=63; c01.b=64;
ps = &c01;
p = (short *)ps;
printf("*** p= %x ***\n",*p);
c02.a=63; c02.b=64;
ps = &c02;
p = (short *)ps;
printf("*** p= %x ***\n",*p);
c03.a=63; c03.b=64;
ps = &c03;
p = (short *)ps;
printf("*** p= %x ***\n",*p);
c04.a=63; c04.b=64;
ps = &c04;
p = (short *)ps;
printf("*** p= %x ***\n",*p);
}
For workaround, use switch
'-fno-schedule-insns2' OR '-fno-schedule-insns', while compiling the code. |
| |
| 12. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2'.
main()
{
int i, ia[100], *ip, a, b, c;
for (i = 0; i < 100; i++)
ia[i] = i;
ip = ia;
a = 1;
b = 2;
c = 3;
i = ((int *)(ip + a))[b + c];
if (i == 6) printf("OK\n");
else printf("NG\n");
}
For workaround, use switch
'-fno-optimize-sibling-calls', while compiling the code. |
| |
| 13. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2'.
double func(long);
main(void)
{
long i=0, j=0, a[10][10];
for (i=0; i<10; ++i)
for (j=0; j<10; ++j)
a[i][j]=10;
if (a[i][j]!=(long)func(i)) printf("OK");
else printf("NOT OK");
}
double
func(long l)
{
return 2;
}
For workaround, use switch
'-fno-optimize-sibling-calls', while compiling the code. |
| |
| 14. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2'.
long okcount=0;
main()
{
int i, a[10][10];
for (i=0; i<10; ++i)
a[i][i]=0;
sub(a[5][5], 1);
}
sub(int var,
int val)
{
++okcount;
}
For workaround, use switch
'-fno-optimize-sibling-calls', while compiling the code. |
| |
| 15. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2'.
#define NOT_OK(id) printf("NOT OK! %s\n",id)
main()
{
struct STRUCT{
long double strc_ld;
signed char strc_sc,*strc_cp,strc_aryb[5];
signed short int strc_ss, strc_aryw[100];
signed int strc_si,strc_aryl[2];
double strc_db;
signed long int strc_sl;
union{
signed char unib_c1,unib_c3;
}strc_unib;
}str;
if (str.strc_unib.unib_c1==28 && str.strc_db==3.0);
else NOT_OK("100");
}
For workaround, use switch
'-fno-optimize-sibling-calls', while compiling the code. |
| |
| 16. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2'.
#include <limits.h>
#ifdef __cplusplus
#define _Bool
bool
extern "C" int printf(const char*,...);
#else
extern int printf(const char*,...);
#endif
typedef
struct SB1 {
int li1[10];
}SB1;
main()
{
_Bool lb1 = 1;
SB1 sb1[8];
lb1 += &sb1;
if (lb1 == 1) printf("K\n");
}
For workaround, use switch
'-fno-optimize-sibling-calls', while compiling the code. |
| |
| 17. The following test case generates different
output on execution when compiled using optimization '-O2' and '-O0'.
static int no = 2;
struct TagA1
{
struct TagB *Bp;
struct { int pad; int a; } A1;
};
struct TagB {
int x; int y; };
struct TagC {
int x; int y; };
struct TagD {
struct TagA1 As1;
};
main()
{
struct TagC Cs, *Cp=&Cs, **Cpp=&Cp ;
struct TagD Ds, *Dp = &Ds;
struct TagA1 *iAp = &Dp->As1;
Cs.x = 10;
Cs.y = 20;
Dp->As1.Bp = *((struct TagB **)Cpp);
Dp->As1.A1.a = 5;
iAp->Bp->x = iAp->Bp->y;
(Cs.x == 20)?printf("%s(%d) OK",__FILE__,++no):printf("%s(%d)
NG",__FILE__,++no);
}
For workaround, use switch
'-fno-schedule-insns2', while compiling the code. |
| |
| 18. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2' .
int main()
{
int i, x, id = 30, y[300];
for(i=0;i<=10;++i) {
x = id + i ;
y[id+i] = x;
}
for(i=30; i<=40; i++)
if (y[i] != i)
break;
if (i > 40) printf("OK\n");
}
For workaround, use switch
'-fno-cse-follow-jumps', while compiling the code. |
| |
| 19. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2' .
int main()
{
int i=0, j, a[10][10];
do{
j=0;
do{
a[++i][++j]=0;
}while (j<10);
}while (i<10);
if (a[0][0]==0 && a[1][1]==0 && a[2][2]==0)
printf ("Array initialization OK!\n\n");
else printf ("Array initialization NG!\n\n");
}
For workaround, use switch
'-fno-cse-follow-jumps', while compiling the code. |
| |
| 20. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2' .
main()
{
int i;
float array[100];
for (i=0; i<100; i++){
array[i]=1.1f-i;
}
if ((array[0]==(1.1f-0)) && (array[99]==(1.1f-99)))
printf("OK\n");
else printf("NOT OK\n");
}
For workaround, use switch
'-fno-cse-follow-jumps', while compiling the code. |
| |
| 21. The following test case generates Segmentation
Fault on execution when compiled using optimization '-O2' .
int c1212=1212, c1966=1966, result1, c1=1, work1;
main()
{
int ii, i1=0;
result1=1313;
for (ii=c1; ii<2; ii++) {
switch((i1 = c1212+c1966)) {
case 24: break;
case 25: break;
case 26: work1 = c1212/c1966+144;
break;
case 27: work1 = c1212/c1966+155;
break;
default: work1 = c1966/c1212+411212;
}
(result1 += (2*i1)+result1);
}
if (result1 == (1212+1966)*2+1313);
} |
| |
| 22. Exception handler is not generating expected
error number while using sqrt function for a negative number. |
| |
|
23. The following test case
generates different output when compiled using optimization '-O2' and
'-O0'.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2 with '-O2' and '-O0'.
class TBase1 {
public:
int a,b;
TBase1(int i= 1, int j = 2) : a(i),b(j){ };
int foo() { return a+b ;}
};
struct TBase2
{
int c,d;
TBase2(int i = 3, int j = 4) : c(i), d(j) { }
};
struct
A_STRUCT : public virtual TBase1, virtual public TBase2 { };
struct
B_STRUCT :public A_STRUCT { };
int
compare(int a,int b,int tcase )
{
if (a == b) printf("\nCase %d : OK\n",tcase);
else printf("\nCase %d : ERROR\n",tcase);
}
int main()
{
int tcase =1;
B_STRUCT s;
compare(s.A_STRUCT::a,1,tcase);
++s.TBase2::c;
((A_STRUCT &)s).TBase2::d--;
tcase++;
compare(((A_STRUCT &)s).TBase2::c, 4,tcase);
tcase++;
compare(s.d, 3,tcase);
} |
| |
|
24. The following test case
generates compile time error.
Same behaviour is observed when
compiled with 'i686-pc-gnu-linux-gcc' v4.2
int f(int, int);
int main(void)
{
int f(int, int = 23);
int f(int = 2, int);
} |
| |
Observations specific to ABI used for the toolchain:
The following test cases generate compilation error when
compiled using 'sh4-linux-gcc'.
This is the expected
behaviour of GNU SH Application Binary Interface (ABI).
However, using Renesas Calling convention (option: '-mrenesas') the test cases compile successfully.
| 1.
void f1(int,...);
main()
{
f1(3,11L,22,(char)33);
}
void f1(int
n_ptrs, ...)
{
int reti;
va_list ap;
char *c;
va_start(ap,n_ptrs);
reti=va_arg(ap,int);
c = (char*)ap+1;
c = ap +1 ;
}
|
| |
| 2.
#include<stdio.h>
#include <cstdarg>
static
va_list T;
int main(void)
{
if( T == 0 ) printf("OK\n");
else printf( "Type static va_list not set to zero\n" );
}
|
| |
| 3.
#include <stdarg.h>
extern void
f1(int,...);
double f;
main()
{
f=3.3e1;
f1(2,f,f);
}
void f1(int
n_ptrs,...)
{
va_list ap;
int i;
va_start(ap, n_ptrs);
va_end(ap);
vprintf("%E,%G",(char *)ap);
printf(" %d i\n",i);
}
|
| |
|