"Kewen.Lin" <li...@linux.ibm.com> writes:
> on 2022/12/7 20:55, Richard Sandiford wrote:
>> "Kewen.Lin" <li...@linux.ibm.com> writes:
>>> Hi Richard,
>>>
>>> on 2022/12/7 17:16, Richard Sandiford wrote:
>>>> "Kewen.Lin" <li...@linux.ibm.com> writes:
>>>>> Hi,
>>>>>
>>>>> In the recent discussion on how to make some built-in type only valid for
>>>>> some target features efficiently[1], Andrew mentioned this patch which he
>>>>> made previously (Thanks!).  I confirmed it can help rs6000 related issue,
>>>>> and noticed PR99657 is still opened, so I think we still want this to
>>>>> be reviewed.
>>>>
>>>> But does it work for things like:
>>>>
>>>>     void f(foo_t *x, foo_t *y) { *x = *y; }
>>>>
>>>> where no variables are being created with foo_t type?
>>>>
>>>
>>> I think it can work for this case as it touches build_indirect_ref.
>> 
>> Ah, ok.  But indirecting through a pointer doesn't seem to match
>> TCTX_AUTO_STORAGE.
>> 
>
> Indeed. :)
>
>> I guess another case is where there are global variables of the type
>> that you want to forbid, compiled while the target feature is enabled,
>> and then a function tries to access those variables with the target
>> feature locally disabled (through a pragma or attribute).  Does that
>> case work?
>> 
>
> Thanks for pointing out this, I tried with the below test case:
>
> __vector_quad a1;
> __vector_quad a2;
>
> __attribute__((target("cpu=power8")))
> void foo ()
> {
>   a2 = a3;
> }
>
> the verify_type_context doesn't catch it as you suspected, I think
> it needs some enhancements somewhere.

FWIW, another possible case is:

  foo_t f();
  void g(foo_t);
  void h() { g(f()); }

I'm not aware of any verify_type_context checks that would catch this
for SVE (since it's valid for SVE types).

Thanks,
Richard

Reply via email to