[M3devel] importing types not described to backend

Jay K jay.krell at cornell.edu
Fri Aug 27 20:28:47 CEST 2010


This is distilled from m3-ui/anim3d/src/x-opengl/X_OpenGL_Base.m3

INTERFACE Color;
TYPE T = RECORD a,b,c:REAL; END;
END Color.


MODULE Main;
IMPORT Color;
TYPE ColorT = RECORD a,b,c: REAL; END;


<*NOWARN*> PROCEDURE F1 (a,b,c,d,e,f:INTEGER; g:ColorT) =
BEGIN
END F1;


<*NOWARN*> PROCEDURE F2 (a,b,c,d,e,f:INTEGER; g:Color.T) =
BEGIN
END F2;


BEGIN
  F1(1,2,3,4,5,6,ColorT{1.0,2.0,3.0});
  F2(2,3,4,5,6,7,Color.T{2.0,3.0,4.0});
END Main.


On SPARC64_SOLARIS there is an assertion failure in the backend:
/dev2/cm3/m3-sys/m3cc/SPARC64_SOLARIS/gcc/m3cgc1  -mno-app-regs  -quiet -fno-reorder-blocks -funwind-tables -fPIC   -m64  -gstabs+ Main.mc -o Main.ms
../Main.m3: In function 'Main__F1':
../Main.m3:13: internal compiler error: in function_arg_record_value, at config/sparc/sparc.c:5038


I fixed it so F1 is ok.
But still F2 isn't.
The error is reported for F1, though that is wrong. If you comment out F2, it compiles ok.


The problem as I understand is we don't tell the backend about imported types.
 There is nothing in the IR about them, judging from -y and a quick look at parse.c.


I intend to fix this if I don't here any objections.
I'm hoping it isn't too much work.
I believe it will mostly/all be in m3front.


My opinion of our gcc backend drops..


Perhaps the time is better used on a C front end.
Though in this case, I think the work is shared, the same stuff would be missing there too.


Thanks,
 - Jay
 		 	   		  


More information about the M3devel mailing list