public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* AltiVec too pedantic about type qualifiers
@ 2002-02-24 16:05 Daniel Egger
  2002-02-24 18:13 ` Aldy Hernandez
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Egger @ 2002-02-24 16:05 UTC (permalink / raw)
  To: Aldy Hernandez, GCC Developer Mailinglist

Hija,

I just discovered that AltiVec is quite pedantic and anal about type
qualifiers.

#include <altivec.h>

void test (const char *test)
{
  vector signed char vec;

  vec = vec_ld (0, test);
}

delivers:

test.c: In function `test':
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: warning: passing arg 2 of `__builtin_altivec_lvx' discards
qualifiers 
from pointer target type
test.c:7: incompatible types in assignment

IMHO this should at a maximum deliver on of the warning and no
error at all, given the fact that I just tried to hint the compiler
that the pointer is not used to write to memory.

In real world code this also leads to 

none.c:283: incompatible types in assignment
none.c:296: Internal compiler error in gen_reg_rtx, at emit-rtl.c:654
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

but unfortunately I cannot release this code and I haven't been able to
synthesize a testcase which bails out with an compiler error yet.

-- 
Servus,
       Daniel

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

* Re: AltiVec too pedantic about type qualifiers
  2002-02-24 16:05 AltiVec too pedantic about type qualifiers Daniel Egger
@ 2002-02-24 18:13 ` Aldy Hernandez
  2002-02-25 13:05   ` Daniel Egger
  0 siblings, 1 reply; 6+ messages in thread
From: Aldy Hernandez @ 2002-02-24 18:13 UTC (permalink / raw)
  To: Daniel Egger; +Cc: GCC Developer Mailinglist


On Monday, February 25, 2002, at 10:40  AM, Daniel Egger wrote:

> Hija,
>
> I just discovered that AltiVec is quite pedantic and anal about type
> qualifiers.
>
> #include <altivec.h>
>
> void test (const char *test)
> {
>   vector signed char vec;
>
>   vec = vec_ld (0, test);
> }
>

const problem again.

but if you fix the const, you'll get an incompatible assignment.
this is because you're probably building on darwin which has
char defaulting to unsigned char, so vec_ld will return a
"vector unsigned char".

this is an inconsistency in darwin having chars being unsigned.

so you'll have to do:

void test (signed char *test)
            ^^^^^^
{
   vector signed char vec;
   vec = vec_ld (0, test);
}

i think there's probably a flag to have gcc's chars default to
signed (anyone??)

> none.c:283: incompatible types in assignment
> none.c:296: Internal compiler error in gen_reg_rtx, at emit-rtl.c:654
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>
> but unfortunately I cannot release this code and I haven't been able to
> synthesize a testcase which bails out with an compiler error yet.

ok, *this* is a valid error.  you're going to have to simplify it
enough for me to reproduce.  if you want, send it off list and
i'll fix it.

>
> --
> Servus,
>        Daniel
>
>
--
Aldy Hernandez                                E-mail: aldyh@redhat.com
Professional Gypsy Lost in Australia
Red Hat, Inc.

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

* Re: AltiVec too pedantic about type qualifiers
  2002-02-24 18:13 ` Aldy Hernandez
@ 2002-02-25 13:05   ` Daniel Egger
  2002-02-25 13:10     ` Andrew Pinski
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Egger @ 2002-02-25 13:05 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: GCC Developer Mailinglist

Am Mon, 2002-02-25 um 03.10 schrieb Aldy Hernandez:

> but if you fix the const, you'll get an incompatible assignment.
> this is because you're probably building on darwin which has
> char defaulting to unsigned char, so vec_ld will return a
> "vector unsigned char".

Negative. This is linux-ppc.

> this is an inconsistency in darwin having chars being unsigned.

This is no problem here. :)
 
> i think there's probably a flag to have gcc's chars default to
> signed (anyone??)

-fsigned-char
 
-- 
Servus,
       Daniel

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

* Re: AltiVec too pedantic about type qualifiers
  2002-02-25 13:05   ` Daniel Egger
@ 2002-02-25 13:10     ` Andrew Pinski
  2002-02-25 14:13       ` Daniel Egger
  2002-02-25 15:10       ` Aldy Hernandez
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Pinski @ 2002-02-25 13:10 UTC (permalink / raw)
  To: Daniel Egger; +Cc: Aldy Hernandez, GCC Developer Mailinglist

On PPC, all char's are unsigned by default.

Thanks,
Andrew Pinski
On Monday, February 25, 2002, at 03:40 , Daniel Egger wrote:

> Am Mon, 2002-02-25 um 03.10 schrieb Aldy Hernandez:
>
>> but if you fix the const, you'll get an incompatible assignment.
>> this is because you're probably building on darwin which has
>> char defaulting to unsigned char, so vec_ld will return a
>> "vector unsigned char".
>
> Negative. This is linux-ppc.
>
>> this is an inconsistency in darwin having chars being unsigned.
>
> This is no problem here. :)
>
>> i think there's probably a flag to have gcc's chars default to
>> signed (anyone??)
>
> -fsigned-char
>
> --
> Servus,
>        Daniel
>
>
>

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

* Re: AltiVec too pedantic about type qualifiers
  2002-02-25 13:10     ` Andrew Pinski
@ 2002-02-25 14:13       ` Daniel Egger
  2002-02-25 15:10       ` Aldy Hernandez
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Egger @ 2002-02-25 14:13 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Aldy Hernandez, GCC Developer Mailinglist

Am Mon, 2002-02-25 um 22.09 schrieb Andrew Pinski:

> On PPC, all char's are unsigned by default.

I never intended to claim something different.
 
-- 
Servus,
       Daniel

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

* Re: AltiVec too pedantic about type qualifiers
  2002-02-25 13:10     ` Andrew Pinski
  2002-02-25 14:13       ` Daniel Egger
@ 2002-02-25 15:10       ` Aldy Hernandez
  1 sibling, 0 replies; 6+ messages in thread
From: Aldy Hernandez @ 2002-02-25 15:10 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Daniel Egger, GCC Developer Mailinglist


On Tuesday, February 26, 2002, at 08:09  AM, Andrew Pinski wrote:

> On PPC, all char's are unsigned by default.

that explains it.

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

end of thread, other threads:[~2002-02-25 22:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-24 16:05 AltiVec too pedantic about type qualifiers Daniel Egger
2002-02-24 18:13 ` Aldy Hernandez
2002-02-25 13:05   ` Daniel Egger
2002-02-25 13:10     ` Andrew Pinski
2002-02-25 14:13       ` Daniel Egger
2002-02-25 15:10       ` Aldy Hernandez

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).