This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: ICE for overlap of asm-register-declared variable and asm clobber list [H8/S target]


[  NOTE:  Redirected from gcc-patches list to gcc list, since it doesn't
contain a patch and since we're just talking about the same subject over
there in another context ]

> -----Original Message-----
> From: gcc-patches-owner On Behalf Of Prafulla Thakare
> Sent: 13 May 2004 10:58
> To: gcc-patches
> Subject: ICE for overlap of asm-register-declared variable 
> and asm clobber list [H8/S target]
> 
> Hi,
> 
> Following code gives ICE (Internal compilation Error). I am 
> compiling it for H8/S target. 
> void bug(char* dst) 
> {
> 	register char* _dst __asm ("er6");
> 	__asm__ ("eepmov.b":"=g"(*_dst)::"r4","er5","er6");
> }
> command used is:
> >h8300-elf-gcc.exe -S bug.c bug.c
> 
> What is expected from this code while compiling is "Simple 
> error" saying "asm-specifier for variable 'dst' conflicts 
> with asm clobber list". Instead, it is giving an "Internal 
> Compiler Error". 
> 
> Please refer to earlier posting related to this at 
> http://gcc.gnu.org/ml/gcc-patches/2002-09/msg01168.html.

  Heh.  I happened to be looking at just that patch in the archives only
last night myself!

> As per this patch, this conflict is detected in function 
> "expand_asm_operands()" (stmt.c) while doing "SANITY" check 
> for overlap between clobbers and output operands. 
> I have two queries regarding this;
> 
> 1. As it is well know conflict and error, does it really 
> necessary to give an "Internal Compiler Error"? Or simple 
> conflict error will do? I understand that, the compiler is 
> expected to catch this conflict much earlier and output the error.

  As you correctly deduce, the purpose of HP's patch was to make the
compiler give a nice error message rather than an ICE.  Apparently the patch
is not performing that function for some reason; something has gotten broken
in the meantime, perhaps.

> 2. Where the compiler should catch this error prior to above 
> mention "SANITY" check? I guess it should be able to this in 
> "decl_conflicts_with_clobbers_p()" function. I would like to 
> fix the above problem i.e. Compiler should detect above as 
> clobber conflict and display the error "asm-specifier for 
> variable 'dst' conflicts with asm clobber list" and NOT the ICE.
> 
> Any help on this would be highly appreciated.
> 
> Regards,
> Prafull

  TBH, I'm not even sure myself if it should be an error.  The compiler
documentation states that you can't rely on the value always being in the
hard reg (because it might be temporarily spilled to the stack).  I don't
think gcc should issue an error when it sees a hard asm reg in a list of asm
clobbers: I think it should spill the hard asm reg variable to the stack for
the duration of the asm block and reload it afterward, shouldn't it ?

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]