On Tue, Feb 19, 2019 at 3:29 PM Matthew Malcomson <matthew.malcom...@arm.com> wrote: > > Hi there, > > I'd like to make handling of the __RTL function testcases where the > startwith pass name is either invalid, not used for that optimisation > level, or non-existant more understandable. > > Currently a problem with the pass name leaves around state that causes > the compiler to ICE on other functions. > If the pass name is invalid or one not used for the current optimisation > level then "dfinit" is run, but "dfinish" is not, which breaks an > assertion in the `rest_of_handle_df_finish` function. > For any of the problems the "*clean_state" pass is not run, which causes > an ICE on the first C function in the TU. > > The ICE's I've seen can be avoided by always running the "*clean_state" > pass (including if the startwith pass of the function is not specified) > and by always running the "dfinish" pass if the "dfinit" pass is run and > I am working on a patch to do this. > > Since the function will not emit any code for any of these problems, I > was wondering whether to emit a -Wunused-function warning pointing to > the bad name (or to the area where a name should be), since it's > unlikely to be intended. > The current behaviour (apart from causing an ICE on other functions) is > to silently do nothing.
You are supposed to write correct __RTL (or __GIMPLE). Possibly clearing bad state to not leak to other functions might be a good idea though. Richard. > > Example for "ICE after a bad name". > > > int > foo_a () > { > return 200; > } > > > int __RTL (startwith ("badname")) foo2 () > { > (function "foo2" > (insn-chain > (block 2 > (edge-from entry (flags "FALLTHRU")) > (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) > (cinsn 101 (set (reg:DI x19) (reg:DI x0))) > (cinsn 10 (use (reg/i:SI x19))) > (edge-to exit (flags "FALLTHRU")) > ) ;; block 2 > ) ;; insn-chain > ) ;; function "foo2" > } > > > Cheers, > Matthew