https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128339
Bug ID: 128339
Summary: 128-bit division doesn't work on gcc-17
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: mikulas at artax dot karlin.mff.cuni.cz
Target Milestone: ---
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
volatile unsigned __int128 a = atol(argv[1]);
volatile unsigned __int128 b = atol(argv[2]);
volatile unsigned __int128 c;
c = a / b;
printf("%llx\n", (unsigned long long)c);
return 0;
}
On gcc-17 from Cygwin (version 17.0.0+20261004-0.1), this program returns zero
or crashes with floating point exception if the first argument is zero. The bug
happens with or without optimization. gcc-16 and older work.