[AVR] Fix broken bitcast for aliases in non-zero address space
authorAyke van Laethem <aykevanlaethem@gmail.com>
Thu, 24 Nov 2022 19:24:36 +0000 (20:24 +0100)
committerAyke van Laethem <aykevanlaethem@gmail.com>
Sun, 27 Nov 2022 14:27:42 +0000 (15:27 +0100)
commit131cddcba2c4c953a8a49d7adbf656cab9e9f1c7
tree2447708383f3e5d612d67086672ffde4499fe26b
parent6a353c7756f2def4bbc48b4c76c8f173f05a6fa0
[AVR] Fix broken bitcast for aliases in non-zero address space

This was triggered by some code in picolibc. The minimal version looks
like this:

    double infinity(void) {
       return 5;
    }

    extern long double infinityl() __attribute__((__alias__("infinity")));

These two declarations have a different type (not because of the 'long
double', which is also 'double' in IR, but because infinityl has
variadic parameters). This led to a crash in the bitcast which assumed
address space 0.

Differential Revision: https://reviews.llvm.org/D138681
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/avr/alias-avr.c