Bug 47672 - math-68881.h does not support C99
Summary: math-68881.h does not support C99
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-09 23:24 UTC by Vincent Riviere
Modified: 2015-01-17 07:57 UTC (History)
2 users (show)

See Also:
Host:
Target: m68k-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Fix for math-68881.h and C99 (967 bytes, patch)
2011-02-09 23:27 UTC, Vincent Riviere
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Riviere 2011-02-09 23:24:07 UTC
The file gcc/config/m68k/math-68881.h is distributed with GCC, however it does not support C99. When this file is included in multiple files, then compiled with --std=c99 or --std=gnu99 this leads to duplicate definitions.
This is because it uses "extern inline" unconditionally.
Comment 1 Vincent Riviere 2011-02-09 23:27:51 UTC
Created attachment 23291 [details]
Fix for math-68881.h and C99

This patch fixes the problem.
Comment 2 Andreas Schwab 2011-05-02 17:20:40 UTC
I'd rather remove that file.
Comment 3 Alan Hourihane 2011-06-06 09:02:59 UTC
Should math-68881.h be part of a OS's libc/libm then ?
Comment 4 Vincent Riviere 2011-06-06 19:06:07 UTC
Normal math implementation should always reside inside libm, to fully support  exceptions, error handling, etc.

When better speed is required, and strict standard compliance is not required, a user can compile his program with -ffast-math. As a result, any call to sin() will be implemented by a single fsin instruction rather than a call to libm. The purpose is the same as math-68881.h. But the implementation is different: math-68881.h relies on the preprocessor, while -ffast-math is directly handled by GCC at low level for better register usage, etc. This is why ideally math-68881.h should be removed from GCC and -ffast-math always used by the users, when needed. However, someone reported that all the functionnality of math-68881.h was not reported to -ffast-math: some instructions are missing.

So I propose the following roadmap:

1) Commit my proposed patch, then close this bug. This will fix the current math-68881.h for C99. I hit that problem when compiling libtiff.

2) Move the missing functionnality from math-68881.h to -ffast-math, then remove math-68881.h from GCC.
Comment 5 Mikael Pettersson 2011-06-06 19:54:58 UTC
(In reply to comment #4)
> However, someone reported that all the functionnality of
> math-68881.h was not reported to -ffast-math: some instructions are missing.
...
> 2) Move the missing functionnality from math-68881.h to -ffast-math, then
> remove math-68881.h from GCC.

I only see this PR and PR49295 mention math-68881.h, and neither PR lists any missing instructions.

What specific instructions are missing from -ffast-math?
Comment 6 Vincent Riviere 2011-06-06 21:20:46 UTC
> What specific instructions are missing from -ffast-math?

I don't know myself, but I have been told it was the case.
http://gcc.gnu.org/ml/gcc/2011-02/msg00186.html
Comment 7 Jeffrey A. Law 2015-01-17 07:57:01 UTC
math-m68881.h is obsolete and should not be used.  There are no plans to fix/upgrade the contents of that file.