[Bug c/82349] New: float INFINITY issue with division by zero in regression with compiler option '-ffast-math'

2017-09-28 Thread marc.pres at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82349

Bug ID: 82349
   Summary: float INFINITY issue with division by zero in
regression with compiler option '-ffast-math'
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marc.pres at gmx dot net
  Target Milestone: ---

Given this code snippet:

#include 
#include 

int main(void) {

int denom=0;
printf("%d %d %d\n", (int)(1.0/denom), (int)(1.0/0), (int)INFINITY);

return 0;
}

bash> gcc infinity.c

bash> -2147483648 -2147483648 2147483647

bash> gcc infinity.c -ffast-math

bash> -2147483648 2147483647 2147483647

What is unclear regarding the IEEE standard and the supplement documentation of
option "-ffast-math", is why is 1. first and 2. term in are different in sign
AND why are the 2 outputs generally different.

In my opionion all the terms above should be positive like 2147483647.


Dr. Marcello Presulli

[Bug c/82350] New: float INFINITY issue with division by zero in regression with compiler option '-ffast-math'

2017-09-28 Thread marc.pres at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82350

Bug ID: 82350
   Summary: float INFINITY issue with division by zero in
regression with compiler option '-ffast-math'
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marc.pres at gmx dot net
  Target Milestone: ---

Given this code snippet:

#include 
#include 

int main(void) {

int denom=0;
printf("%d %d %d\n", (int)(1.0/denom), (int)(1.0/0), (int)INFINITY);

return 0;
}

bash> gcc infinity.c

bash> -2147483648 -2147483648 2147483647

bash> gcc infinity.c -ffast-math

bash> -2147483648 2147483647 2147483647

What is unclear regarding the IEEE standard and the supplement documentation of
option "-ffast-math", is why is 1. first and 2. term are different in sign AND
why are the 2 outputs generally different.

In my opionion all the terms above should be positive like 2147483647.


Dr. Marcello Presulli

[Bug c/82351] New: float INFINITY issue with division by zero in regression with compiler option '-ffast-math'

2017-09-28 Thread marc.pres at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82351

Bug ID: 82351
   Summary: float INFINITY issue with division by zero in
regression with compiler option '-ffast-math'
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marc.pres at gmx dot net
  Target Milestone: ---

Given this code snippet:

#include 
#include 

int main(void) {

int denom=0;
printf("%d %d %d\n", (int)(1.0/denom), (int)(1.0/0), (int)INFINITY);

return 0;
}

bash> gcc infinity.c

bash> -2147483648 -2147483648 2147483647

bash> gcc infinity.c -ffast-math

bash> -2147483648 2147483647 2147483647

What is unclear regarding the IEEE standard and the supplement documentation of
option "-ffast-math", is why is 1. first and 2. term are different in sign AND
why are the 2 outputs generally different.

In my opionion all the terms above should be positive like 2147483647.


Dr. Marcello Presulli

[Bug c/82349] float INFINITY issue with division by zero in regression with compiler option '-ffast-math'

2017-09-28 Thread marc.pres at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82349

--- Comment #4 from Marcello Presulli  ---
Thats clear, but why are the 2 terms different each.
If so, they should output the same, because what would be the difference
between 1.0/denom and 1.0/0 in case of fast-math ?