Comments (9)
@calint I would recommend creating a small reproducer for this issue and uploading it to the Compiler Explorer (godbolt.org). There you can switch between different compilers and architectures and see if this behavior is unique to GCC 8.4 or not.
from crosstool-ng.
I cannot reproduce it in godbolt. In the actual code it does optimize away a store. I can produce generated assembler with source annotations.
Boiled down to a description in code is:
#include <cstdio>
#include <cstdlib>
#include <iostream>
class object {
public:
object **alloc_ptr;
int x = 1;
int y = 2;
};
inline __attribute__((always_inline)) object *alloc() {
object *mem = (object *)malloc(sizeof(object));
mem->alloc_ptr = (object **)(0xf00ba7); // this store gets optimized away
return mem;
}
int main() {
object *o = new (alloc()) object;
printf("%p\n", o->alloc_ptr); // UB
}
I am probably doing UB... It is solved with the compiler flag.
Thanks
from crosstool-ng.
Related Issues (20)
- `make install` fails by undefined symbol errors. HOT 1
- support for arm64-apple-macosx13.0.0 binaries HOT 2
- Generate latest toolchain for ESP8266 - why was support dropped as of 2020r3? HOT 5
- Please upload esp-12.2.0 to platformio registry HOT 26
- Add 8.4.0+2021r2-patch3 back to PlatformIO registry HOT 1
- esp-12.2.0_20230208 missing gdb HOT 4
- git clone modules not found `esp-toolchain-bin-wrappers`and `xtensa-dynconfig` HOT 3
- xtensa-esp32s2-elf-gcc: internal compiler error: Segmentation fault signal terminated program cc1 HOT 2
- GH Actions Build HOT 3
- Support for C++20 ranges HOT 7
- fatal error: type_traits: No such file or directory HOT 2
- xtensa-esp-elf: how to influence endianness ? HOT 4
- 我使用Arduion编译Esp32项目时出错,换用2.0.11\2.0.12\2.0.14\3.0.0 Alpha版本的库和多个IDE版本均报错"\bits\allocator.h:46:10: fatal error: bits/c++allocator.h: No such file or directory" HOT 2
- xtensa: Size optimization regression between GCC 8.4.0 and 13.2.0 HOT 21
- Assembly code macros not working HOT 11
- Build error on google colab HOT 1
- Update platformio toolchain package registry with latest releases HOT 1
- gold / lld support for parallel linking HOT 9
- Linker from esp-13.2.0-20230928 cannot locate objects or libraries that are specified with absolute paths HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crosstool-ng.