On Jan 29, 2013, at 8:52 PM, Jerry wrote: > > On Jan 29, 2013, at 5:02 PM, Orion Poplawski wrote: > >> On 01/29/2013 03:21 AM, Jerry wrote: >>> >>> Hi Orion, >>> >>> This is puzzling. I can't see what could possibly be causing this. (By >>> "this" I mean the x02.adb example, as I haven't looked any of the others.) >>> I have not set ranges for any of the entities involved. (In Ada, you can >>> specify an allowed range for a variable. For instance, one could specify >>> that r1 is constrained between 0.0 and 1.0 and any attempt to assign a >>> value outside that range would raise an overflow (I think) exception.) So I >>> don't see where there is an opportunity to overflow either r1, a 64-bit >>> float or r( ), a 32-bit integer. >>> >>> FWIW, GNAT does something a little controversial--it defaults to disabling >>> overflow checking. The controversy is that this compiler is then, by >>> default, not an Ada compiler. But I don't see how that is apropos to this >>> situation. >>> >>> Can you try running this program and report the results? >>> >>> >>> with Ada.Text_IO; use Ada.Text_IO; >>> procedure Test_Overflow is >>> r : Integer; >>> r1 : Long_Float := 0.3; >>> begin >>> Put_Line("Running...."); >>> r := Integer((r1 * 255.001) - 0.499999999999999); >>> end Test_Overflow; >>> >>> >>> Compile and run: >>> >>> $ gnatmake Test_Overflow.adb >>> $./test_overflow >>> >>> I also tried it with overflow checking turned on: >>> >>> $ gnatmake -gnato Test_Overflow.adb >>> $./test_overflow >>> >>> It works either way on my system. >> >> >> [orion@vmrawhide ~]$ gnatmake Test_Overflow.adb >> gcc -c Test_Overflow.adb >> Test_Overflow.adb:2:11: warning: file name does not match unit name, should >> be "test_overflow.adb" >> gnatbind -x Test_Overflow.ali >> gnatlink Test_Overflow.ali >> >> [orion@vmrawhide ~]$ ./Test_Overflow >> Running.... >> >> raised CONSTRAINT_ERROR : Test_Overflow.adb:7 overflow check failed >> [[orion@vmrawhide ~]$ rm Test_Overflow Test_Overflow.o Test_Overflow.ali >> [orion@vmrawhide ~]$ gnatmake -gnato Test_Overflow.adb >> gcc -c -gnato Test_Overflow.adb >> Test_Overflow.adb:2:11: warning: file name does not match unit name, should >> be "test_overflow.adb" >> gnatbind -x Test_Overflow.ali >> gnatlink Test_Overflow.ali >> [orion@vmrawhide ~]$ ./Test_Overflow >> Running.... >> >> raised CONSTRAINT_ERROR : Test_Overflow.adb:7 overflow check failed >> >> >> -- >> Orion Poplawski >> Technical Manager 303-415-9701 x222 >> NWRA, Boulder Office FAX: 303-415-9702 >> 3380 Mitchell Lane or...@nwra.com >> Boulder, CO 80301 http://www.nwra.com > > Orion: > > I've queried the oracle (comp.lang.ada). > > Jerry
The oracle had two responses. (Note that wrt the second response, I in fact did mention that you are on Fedora Rawhide.) (1) Well, GCC 4.8 hasn't been released yet! but a quick check through the bugs/regressions doesn't show anything like this. Let's hope it doesn't make it to the release .. Neither GCC 4.7.0 nor GNAT GPL 2012 shows the problem. (2) I wonder if his hardware (you didn't say what processor/OS the person with the problem is running on) is either setting some bit incorrectly, or the bit is being interpreted wrong. I saw something like this when we implemented hardware conversions in Janus/Ada, as some weird bits were getting set that we misinterpreted as an error. It's possible to set up the Intel hardware to trap, and that could happen for underflow and other loss-of-precision cases, and such a trap would probably get reported as an overflow error. It even possible that his OS has left some goofy setup in the floating point unit which causes bogus traps (bad device driver?). Did he try rebooting and/or running a "clean" system? Orion: I checked the 18 places that you reported an error and in every line, there is a conversion of Long_Float to Integer using the Integer( ) function with a Long_Float as an argument. It appears extremely likely that in each case the exception is being raised at the first attempt to make the conversion in a given example. I don't think there is anything that I can do for this situation. If you are sure that you don't have a hardware problem re (2) above then someone should file a bug report, but, as far as I'm concerned, my note to comp.lang.ada suffices since there are a number of gurus on the list and I assume the GNAT folks monitor the list although if so they are surely quiet or anonymous. Jerry ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel