https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123737

Steve Fan <stevefan1999 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stevefan1999 at gmail dot com

--- Comment #9 from Steve Fan <stevefan1999 at gmail dot com> ---
We also have a reproduction here:
```cpp
#include <cstdio>

struct S {
  int n = 0;
  S &operator,(int) { return ++n, *this; }
  S &operator<<(int) { return *this; }
};

#define SEQ_128                                                               
\
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,  
\
      22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 
\
      40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 
\
      58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 
\
      76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 
\
      94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,    
\
      109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,   
\
      123, 124, 125, 126, 127, 128
#define SEQ_129 SEQ_128, 129

// Test function macro
#define TEST_N(name, seq, expected)                                           
\
  int name() {                                                                
\
    S s;                                                                      
\
    s << 0, seq;                                                              
\
    printf(#name ": %d (expected %d)\n", s.n, expected);                      
\
    return s.n == expected;                                                   
\
  }

TEST_N(with_128, SEQ_128, 128)
TEST_N(with_129, SEQ_129, 129)

int main() {
  int pass = with_128() & with_129();
  return printf("buggy? %s\n", pass ? "no" : "yes"), !pass;
}

```
Coincidentally this bug was also found by my CTO around the same time in the
same day. We had this problem because we filled a matrix that is more than 128
entries in Eigen style.

Reply via email to