On Sun, 19 Apr 2020 17:26:49 +0200
Charlene Wendling <[email protected]> wrote:
> As i'm doing the first macppc clang bulk atm, i've found out that two
> (for now) ports issue very similar backend errors.
>
> I'm attaching the preprocessed sources and run scripts for these two.
I took your attached source from devel/avr/binutils and cut out a
smaller example, which errors $ clang -O2 -c smaller.c
$ cat smaller.c
// cut from print_gnu_build_attribute_description()
void example(unsigned long *p)
{
if (*p > ((*p + 15ULL) & ~15ULL))
*p = 6799;
*p = 1299;
}
"clang -O1" and "clang -O2 -mno-crbits" don't cause the error.
I thank mortimer for finding -mno-crbits.
The "Cannot select: ... adde" error requires these 4 items:
1. In the 64-bit unsigned addition *p + 15ULL, each operand must fit
in 32 bits, such that the upper half is 0 + 0.
2. The *p must read from memory. The code in binutils was reading a
variable "static unsigned long global_end".
3. The *p > ... comparison must be >. None of the other comparisons
>= <= < == != cause the error. Reversing the comparison to
((*p + 15ULL) & ~15ULL) < *p does still cause the error.
4. The & in (...) & ~15ULL can't be | or ^.
I now have a PowerBook G4 with 1G RAM that recently built clang and
still has clang's .o files. If I modify clang's code (I haven't yet),
I should be able to rebuild clang.
--George