public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Should invalid __RTL testcase "startwith" passes emit a warning?
@ 2019-02-19 14:29 Matthew Malcomson
  2019-02-20  8:35 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Malcomson @ 2019-02-19 14:29 UTC (permalink / raw)
  To: gcc; +Cc: nd

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.


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Should invalid __RTL testcase "startwith" passes emit a warning?
  2019-02-19 14:29 Should invalid __RTL testcase "startwith" passes emit a warning? Matthew Malcomson
@ 2019-02-20  8:35 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2019-02-20  8:35 UTC (permalink / raw)
  To: Matthew Malcomson; +Cc: gcc, nd

On Tue, Feb 19, 2019 at 3:29 PM Matthew Malcomson
<Matthew.Malcomson@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-20  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 14:29 Should invalid __RTL testcase "startwith" passes emit a warning? Matthew Malcomson
2019-02-20  8:35 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).