https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118978

--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 60557
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60557&action=edit
Proposed fix which detects an incorrect parameter being passed

the ICE occurs when a range test is performed on incompatible types.  The fix
adds dependencies to the range tests to respective type tests.  If a parameter
type check fails then the subsequent range checks are cancelled.  In the ICE an
error message had been generated but the subsequent range checks were still
performed.

The result with the patch is shown below:

$ gm2 -c badparamtype.mod 
<built-in>: error: formal parameter ‘INTEGER’
<built-in>: error: actual parameter the RType
badparamtype.mod:9:9: error: 1st parameter failure due to assignment
incompatibility between actual parameter ‘3.14’ and the 1st formal ‘i’
parameter in procedure ‘foo’
    9 |    foo (3.14)
      |         ^~~~

Reply via email to