[Bug target/85744] Returning INT_FAST64_MIN become zero

2018-05-11 Thread cerlane at nscc dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85744

--- Comment #7 from cerlane  ---
(In reply to Jonathan Wakely from comment #5)
> You should have read https://gcc.gnu.org/bugs/ which explains what we need
> for a valid bug report, and would have done that before reporting it.
> 
> You probably forgot to declare the function in the calling code so the
> compiler assumed it returned int, and only used the low 32 bits, which are
> all zero.

No that is not true. I have the function declared in the header file. It is
included everywhere.
The problem is harder to debug. For all other #values, they work correctly. I
still can't figure out the issue. I tested every combination including compiler
flags before my last reply. If it turns out to be a compiler issue, I will
resubmit. Thanks.

[Bug target/85744] Returning INT_FAST64_MIN become zero

2018-05-11 Thread cerlane at nscc dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85744

cerlane  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from cerlane  ---
(In reply to Andrew Pinski from comment #3)
> Can you provide the preprocessed source then?

To provide the preprocessed source, I extracted the function and call it
directly from the same file. It then returns the correct value. However, when I
called the "actual" function, which is in an archive, I reproduce the error. 

This means it is not a gcc standard error, but a compilation or some other
issues. I am unsure if this is the correct place to continue the discussion.

Thanks very much for your very quick response in any case.

[Bug c/85744] Returning INT_FAST64_MIN become zero

2018-05-10 Thread cerlane at nscc dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85744

--- Comment #2 from cerlane  ---
(In reply to Andrew Pinski from comment #1)
> Try 0x8000ULL

No unfortunately, it still returns 0x0.

[Bug c/85744] New: Returning INT_FAST64_MIN become zero

2018-05-10 Thread cerlane at nscc dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85744

Bug ID: 85744
   Summary: Returning INT_FAST64_MIN become zero
   Product: gcc
   Version: 4.8.5
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cerlane at nscc dot sg
  Target Milestone: ---

When returning the value 0x8000LL from a function (return type
int_fast64_t), the value becomes zero (0x0).
Is this a feature to guard against underflowing? If so, how can I return
0x8000LL?