avoidance of lea after 5 operations?

2018-10-11 Thread Jason A. Donenfeld
Hey GCConauts, I've noticed some strange behavior in gcc > 5. unsigned int hmmm5(unsigned int a, unsigned int b, unsigned int c) { return a + (b << c << c << c << c << c); } This function compiles how you'd expect: mov ecx, edx sal esi, cl sal esi, cl sal esi, cl sal esi, cl sal esi, cl lea

armeb bug: -mtune=cortex-a15 broken with -mbe8

2018-10-01 Thread Jason A. Donenfeld
Hello, Compiling with "-march=armv7-a -mtune=cortex-a15 -mbe8" produces code that appears to change the order of words. For example, the word-wise optimized strcpy in musl changes "/dev/fd/" into "/fd//dev". Removing "mtune=cortex-a15" works around the problem. Presumably this is due to some instr

Re: section attribute of compound literals

2018-09-14 Thread Jason A. Donenfeld
Hi Jim, That becomes a bit harder when there are many many items: https://git.zx2c4.com/WireGuard/tree/src/crypto/zinc/selftest/chacha20poly1305.h#n87 Here I'd like to use compound literals to avoid wasting space, as several members are variably sized. Unfortunately I can't do that per https://g

Re: section attribute of compound literals

2018-09-14 Thread Jason A. Donenfeld
Hi Jim, On Thu, Sep 13, 2018 at 10:39 PM Jim Wilson wrote: > The > compound literal could have an address, but we don't have a way to > attach attributes to compound literals. Thanks for the confirmation of the problem. > Since your testcase already has a symbol in the right section, you could

section attribute of compound literals

2018-09-10 Thread Jason A. Donenfeld
Hello, I'd like to have a compound literal exist inside a certain linker section. However, it doesn't appear to work as I'd like: #define __stuffdata __attribute__((__section__("stuff"))) const u8 works[] __stuffdata = { 0x1, 0x2, 0x3, 0x4 }; const u8 *breaks = (const u8[] __stuffdata){ 0x1, 0x2,

gcc 4.7 regression on bool function specialization

2013-01-19 Thread Jason A. Donenfeld
/* * * The output of this with gcc 4.7.2 is: * * 1 * 2 * this generic-int function should not be called * 0 * * * * The output of this with gcc 4.6.3 is: * * 1 * 2 * this type-bool function SHOULD BE called * 1 * */ #include #include #include #include struct Type { int dummy