This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/68456] New: UINT32_TYPE is long unsigned for 32bit targets
- From: "julia.koval at intel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Nov 2015 10:36:41 +0000
- Subject: [Bug target/68456] New: UINT32_TYPE is long unsigned for 32bit targets
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68456
Bug ID: 68456
Summary: UINT32_TYPE is long unsigned for 32bit targets
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: julia.koval at intel dot com
Target Milestone: ---
This problem exists for gcc at least for --target=i586-elf, --target=i386-elf.
It is caused by the file gcc/config/newlib-stdint.h. It has:
#ifndef STDINT_LONG32
#define STDINT_LONG32 (LONG_TYPE_SIZE == 32)
#endif
#define UINT32_TYPE (STDINT_LONG32 ? "long unsigned int" : INT_TYPE_SIZE == 32
? "unsigned int" : SHORT_TYPE_SIZE == 32 ? "short unsigned int" :
CHAR_TYPE_SIZE == 32 ? "unsigned char" : 0)
I found a discussion for this, that it is a feature for newlib and wontfix:
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01321.html
However, this problem remains, if I build the compiler without --with-newlib
flag.
Reproduce:
-bash-4.2$ cat test.c
int main(){
uint32_t val = 5;
}
-bash-4.2$ ./target_compiler/install/bin/i586-elf-gcc test.c -dM -E | grep
INT32_TYPE
#define __INT32_TYPE__ long int
#define __UINT32_TYPE__ long unsigned int
This problem causes strange warnings, for example in printf("%u...", if this
type is not overriden somewhere in the library:
": format '%u' expects argument of type 'unsigned int', but argument 2 has type
'uint32_t {aka long unsigned int}' "
I also tried to build a newlib toolchain without this feature and it worked ok
for me. This problem was found as a difference between gcc and llvm behavior.