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

            Bug ID: 90628
           Summary: __builtin_mul_overflow writes to const qualified
                    integer
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc.hall at gmail dot com
  Target Milestone: ---

The following code compiles without any warning.  The same applies to add and
sub.  It does the multiply correctly.


  const int a = argc;
  const int b = argc;

  if( __builtin_mul_overflow( a, b, &a ) )
    puts( "overflow" );

  printf( "square = %d\n", a );

Reply via email to