<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115957>115957</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang's isSignedCharDefault() is incorrect for multiple architectures
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            clang:frontend,
            ABI,
            diverges-from:gcc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          arichardson
      </td>
    </tr>
</table>

<pre>
    While debugging a signed/unsigned char issue I started looking at the list of triples that use unsigned chars by default and it appears the logic in Clang does not match the ABI documents for some architectures. I noticed some issues while isSignedCharDefault() with the Rust list of systems with unsigned char: https://github.com/rust-lang/rust/blob/6503543d11583d1686d4989847b2afbec8d9fdba/library/core/src/ffi/mod.rs#L92 

So far it appears, s390x and csky, xtensa and msp430 are missing from isSignedCharDefault(), but there might be other omissions.

- csky: https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf says CSKY should have unsigned char by default
- s390x: https://github.com/IBM/s390x-abi states the range of `char` is `0 … 2^n − 1`, i.e. it uses `unsigned char`
- msp430: https://www.ti.com/lit/pdf/slaa534 states `the char type is unsigned by default`, GCC agrees
- xtensa: GCC says char is unsigned, not sure where the ABI document is.

I don't see a CSKY GCC on godbolt, but https://godbolt.org/z/qaaW18znY confirms that the other architectures diverge from GCC
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVU2P2zgP_jXKhUhgyx9JDj5kPHUR9C3wYge7RU-BPmhbW1vKivKk6a9fyM6kTRfbvSSSKIoPHz6kBZHpLGLFiidWPK_EFHrnK-GN6oXX5OxKOn2tPvVmQNAop64ztgMBs59mvJnssoToAYZoQjgCBeEDahic-zI7BAg9wmAogGsheHMekCD0IsBECA-vEMgraGzFNAQQVoMJIM5njJb5FdcZBcZCPQjbgXZIYF2A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