This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, libfortran]: Initialize result variable (+ other changes)


On Wed, Jun 19, 2013 at 8:27 AM, Tobias Burnus <burnus@net-b.de> wrote:

>> Attached patch initializes return variable in get_fpu_except_flags.
>> Additionally, it uses __asm__ and __volatile__ consistently, as
>> recommended for header files and unifies a bunch of formatting issues
>> throughout the file.
>
>
> OK. Thanks for having a second look and improving the file.

Actually, on a third look, there are multiple other issues in this file:

1. "cw_sse &= 0xffff0000;" is wrong, since it also clears FTZ, RC and DAZ flags.

2. x87 also needs to clear stalled exception flags, otherwise stalled
flag triggers exception, when corresponding exception bit is unmasked.

3. fsfcw should be used instead of fnstcw, so all pending exceptions
are handled (please note that in case when sticky exception flag is
not cleared in the exception handler, point 2 applies).

4. A lot of code could be simplified in set_fpu function.

2013-06-19  Uros Bizjak  <ubizjak@gmail.com>

    * config/fpu-387.h (_FPU_MASK_ALL): New.
    (set_fpu): Use fstcw to store x87 FPU control word. Use fnclex to
    clear stalled exception flags.  Correctly clear stalled SSE
    exception flags.  Simplify code.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu.

I will wait for a day for possible comments.

The patch should be committed to all release branches.

Uros.

Attachment: f.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]