Hi, when taking the following code (or on http://tinyurl.com/bs2qa3h to easier play with (leads to gcc explorer, might of course be inactive after some time)) #define BSET //:1 struct A { bool b0 BSET; bool b1 BSET; bool b2 BSET; bool b3 BSET; bool b4 BSET; bool b5 BSET; bool b6 BSET; bool b7 BSET; }; //#define TO (__LINE__%2) #define TO 0 void foo( A& a ) { a.b0 = TO; a.b1 = TO; a.b2 = TO; a.b3 = TO; #if 1 a.b4 = TO; a.b5 = TO; a.b6 = TO; a.b7 = TO; #endif } I see some missed opportunities for optimization. While clang compiles this to: movq $0, (%rdi) ret gcc will compile this to: movb $0, (%rdi) movb $0, 1(%rdi) movb $0, 2(%rdi) movb $0, 3(%rdi) movb $0, 4(%rdi) movb $0, 5(%rdi) movb $0, 6(%rdi) movb $0, 7(%rdi) ret What I think a good debugger should do is: In case of bool being one byte, determine the longest "chain" of values being set, group them into useful operation sizes (2/4/8/16 bytes maybe) and create an appropriate value to store to that location. In the case of the bools being bitset members (above BSET define to try it out) gcc already seems to do this quite fine (things will get the appropriate and/or bitwise operations applied).
dup *** This bug has been marked as a duplicate of bug 23684 ***
The duplicate has been closed as resolved, however the compilation of this example has not changed and is imho still a good opportunity for optimization. Have a look on the gcc explorer with -O3 and gcc 7.3 : https://godbolt.org/g/qWvpSg
Fixed in GCC 8 and above.