Does the problem reproduce on a newer Emscripten? It sounds like either a bug in LLVM (which would probably have been fixed by now) or perhaps undefined behavior in your program. If you can reproduce the issue with the latest Emscripten, would you be able to provide source code that demonstrates the problem?
On Tue, Nov 10, 2020 at 3:12 PM [email protected] < [email protected]> wrote: > I just refactored some old C code of mine. Surprisingly the updated code > failed in a very unexpected manner that I still don't understand. I > narrowed the problem down and here is what the relevant code looks like: > > static uint8_t _x, _y; // ... _x and _y get both initialized and updated > elsewhere > void setOutput(uint8_t val) { ...}void someFunction() { > static uint8_t tmp; > ... > swich(..) { > case foo: { > // tmp = _x & _y; > setOutput( _x & _y); > } > ... > } > } > > The code fails because the _x & _y expression suddenly passes total > garbage > to the setOutput() function. Originally I had used the commented tmp > assignment > and then used tmp as an argument for that call - and that functions > correctly. > > However what I find most puzzling is this: simply uncommenting the "tmp" > assignment - without even using tmp later) makes the problem > disappear...WTF?! > > I am still using an older Emscripten version 1.38 and the effect is there > regardless if I compile to WASM or asm.js and whether or not I am using > different optimizer options or the closure compiler. > > Any ideas what is going on here? Is this some kind of known bug or some C > feature that I am not aware of.. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/636d73be-ce53-4a55-bdba-66b7ab938887n%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/636d73be-ce53-4a55-bdba-66b7ab938887n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EViavdYo5K2J7ZXg%3DDjo1b0aiboaj7nr8H%3DkB8sSoiQAw%40mail.gmail.com.
