Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003917OCamlOCaml generalpublic2005-12-12 18:472013-09-03 16:57
Reportermonniaux 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version3.09.0 
Target VersionFixed in Version 
Summary0003917: ocaml won't compile correctly with icc 9.0 (many standard library calls with end up ending up in Invalid_argument)
DescriptionIf cc is icc (Intel's compiler) version 9, config/auto-aux/hasgot will fail to detect most library functions.

The reason is that hasgot tests whether library function f exists by compiling and linking the following template file:

main() {
  f();
}

icc refuses to compile such a file if f is a C standard library function and the number of arguments of f does not correspond to that in the C standard.

The result is that, for instance, HAS_GETTIMEOFDAY will be undefined and the corresponding OCaml function will always raise Invalid_argument.
Additional InformationSuch behaviour is apparently correct with respect to the C99 standard, section 7.1.4, as recalled in appendix J.2 (i.e. calls to library functions with incorrect number of arguments have undefined behaviour).

I do not know whether it is possible to stop icc from doing so, I do not see any applicable option (safe perhaps for telling it not to use stdlib).

My personal fix is to test for the library functions using gcc, but it is obviously broken in general.

I suggest the hasgot script should be replaced by a script testing for the functions using appropriate arguments.
Tagspatch
Attached Filespatch file icon hasgot-icc.patch [^] (432 bytes) 2007-02-05 09:15 [Show Content]

- Relationships

-  Notes
(0003440)
doligez (administrator)
2005-12-15 13:23

This is going to take a lot of work to fix properly.
(0003862)
monniaux (reporter)
2006-11-24 15:49

One dirty practical hack is to configure under gcc, save s.h, configure with icc, and put back the saved s.h.
(0003913)
oandrieu (reporter)
2007-02-05 09:15

I disagree with david's analysis :) I believe the UB in section 7.1.4 is about incorrect number of arguments in calls to library functions with *variable* number of parameters. Here the problem is simply that there is no declarator at all for the called function.

Adding a (bogus) declarator one is enough to turn the compiler error into a warning.

- Issue History
Date Modified Username Field Change
2005-12-12 18:47 monniaux New Issue
2005-12-15 13:23 doligez Note Added: 0003440
2005-12-15 13:23 doligez Severity minor => feature
2005-12-15 13:23 doligez Status new => acknowledged
2006-11-24 15:49 monniaux Note Added: 0003862
2007-02-05 09:15 oandrieu File Added: hasgot-icc.patch
2007-02-05 09:15 oandrieu Note Added: 0003913
2013-09-03 16:57 doligez Tag Attached: patch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker