gcc7

gcc7.2: argument range exceeds maximum object size 9..7 [-Werror=alloc-size-larger-than=]

[亡魂溺海] 提交于 2019-12-24 01:44:11
问题 The program contains code like follows: int size; ... int *pi = (int*)calloc(size, sizeof(int)); ... Here is the error message when compiled with gcc7.2: error: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] When I change int *pi = (int*)calloc(size, sizeof(int)); to int *pi = (int*)calloc((unsigned int)size, sizeof(int)); The error disappeared. However, in the program, there are many malloc and

flto crash with gcc7.2

旧城冷巷雨未停 提交于 2019-12-10 16:35:57
问题 I have a crash with getline in the following code file. I built gcc7.2 because system updates are not available. Minimal example : #include <iostream> int main(int argc, char *argv[]) { std::string line; while (std::getline(std::cin, line)) { } return 0; } On the following lines, GCC_INSTALL_DIR represents the directory where my own gcc is installed Output : ./a.out a *** Error in `./a.out': free(): invalid pointer: 0x0000000000602200 *** ======= Backtrace: ========= /lib64/libc.so.6(+0x7cfe1

Why does including <utility> break structured bindings in GCC?

空扰寡人 提交于 2019-12-05 12:27:10
问题 Consider: struct Point { int x, y; }; int main() { const auto [x, y] = Point{}; } This code compiles fine with gcc 7.1 in C++17 mode, however this one: #include <utility> struct Point { int x, y; }; int main() { const auto [x, y] = Point{}; } gives an error: bug.cpp: In function 'int main()': bug.cpp:7:16: error: 'std::tuple_size<const Point>::value' is not an integral constant expression const auto [x, y] = Point{}; ^~~~~~ What's going on here? A compiler bug, or is this how structured

Why does including <utility> break structured bindings in GCC?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 23:55:02
Consider: struct Point { int x, y; }; int main() { const auto [x, y] = Point{}; } This code compiles fine with gcc 7.1 in C++17 mode, however this one: #include <utility> struct Point { int x, y; }; int main() { const auto [x, y] = Point{}; } gives an error: bug.cpp: In function 'int main()': bug.cpp:7:16: error: 'std::tuple_size<const Point>::value' is not an integral constant expression const auto [x, y] = Point{}; ^~~~~~ What's going on here? A compiler bug, or is this how structured bindings are supposed to work? Barry This is compiler bug 78939 . Although it's a bit more complicated than

is_lock_free() returned false after upgrading to MacPorts gcc 7.3

我与影子孤独终老i 提交于 2019-11-29 14:10:58
Previously, with Apple LLVM 9.1.0, is_lock_free() on 128-bit structures have returned true. To have complete std::optional support, I then upgraded to MacPorts gcc 7.3. During my first try to compile, I encountered this notorious showstopper linker error: Undefined symbols for architecture x86_64: "___atomic_compare_exchange_16", referenced from: I know that I may need to add -latomic . With Apple LLVM 9.1.0, I don't need it, and I have a very bad feeling about this. If it's lock-free, you usually should not need to link to any additional library, the compiler alone is able to handle it.