[LLVMbugs] [Bug 8899] New: including fenv.h fails on linux

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 4 01:23:24 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=8899

           Summary: including fenv.h fails on linux
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: quintino at vki.ac.be
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5953)
 --> (http://llvm.org/bugs/attachment.cgi?id=5953)
raising fe exceptions

When including the header:

#include <fenv.h>

in Linux, the compiler loses track of the headers being included inside this
header... 

---- /usr/include/c++/4.4/fenv.h has this snippet:

#include <bits/c++config.h>
#if _GLIBCXX_HAVE_FENV_H
# include_next <fenv.h>
#endif

and I think that the #include_next is treated incorrectly, because it should
then parse the /usr/include/fenv.h and apparently it does not.

For the attached example, the errors are:

main.cxx:6:17: error: use of undeclared identifier 'FE_DIVBYZERO'
  if (  flags & FE_DIVBYZERO  ) printf(" division by zero exception\n");
                ^
main.cxx:7:17: error: use of undeclared identifier 'FE_ALL_EXCEPT'
  if (!(flags & FE_ALL_EXCEPT)) printf(" no exceptions\n");
                ^
main.cxx:12:3: error: use of undeclared identifier 'fexcept_t'
  fexcept_t flags;
  ^
main.cxx:14:20: error: use of undeclared identifier 'flags'
  fegetexceptflag(&flags, FE_ALL_EXCEPT);
                   ^
main.cxx:16:15: error: use of undeclared identifier 'flags'
  print_flags(flags);
              ^
main.cxx:18:17: error: use of undeclared identifier 'FE_DIVBYZERO'
  feraiseexcept(FE_DIVBYZERO); /* raise divide-by-zero exception */
                ^
main.cxx:19:30: error: use of undeclared identifier 'FE_DIVBYZERO'
  int excepts = fetestexcept(FE_DIVBYZERO | FE_INEXACT);

I can attest that it works on:

- Mac OS X (Snow Leopard) + clang++ 2.8 (but of course the fenv.h headers are
different)

- Linux Ubuntu 10.10 + gcc 4.4

It fails so far in:

- Linux Ubuntu 10.10 + clang++ 2.8 (but of course the fenv.h headers are
different)

I also tried the svn trunk around one month ago and the problem was the same.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list