On Jan 28, 2013, at 8:47 PM, Orion Poplawski wrote: > On 01/28/2013 07:54 PM, Alan W. Irwin wrote: >> On 2013-01-28 17:01-0700 Orion Poplawski wrote: >> >>> Fedora rawhide has moved to gcc 3.8 and I'm seeing: >>> >>> $ ./x02a -dev psc -o x02a.psc >>> >>> raised CONSTRAINT_ERROR : x02a.adb:138 overflow check failed >>> >>> I'm taking that this is due to some increased checking with ada in >>> 3.8. Thoughts? >> >> Hi Orion: >> >> I am virtually positive you meant the gcc-4.8 development effort which >> (as far as I can tell) has not had a single release yet. So I am >> changing the subject line accordingly. But please confirm that is >> what you meant. >> >> If you meant gcc-4.8, there is always the chance that the symptom you >> are seeing is a general problem caused by some recently introduced >> version incompatibilty between gcc and Ada that still needs to be >> worked out, i.e., a compiler inconsistency issue that has nothing to >> do with PLplot development. On the other hand, it might be a PLplot >> Ada issue that has been detected by (presumably) better error checking >> for the latest versions of gcc/Ada as you have suggested. To help >> decide between those two possibilities, could you give more details? >> >> For example, if you use the make -k option (to keep going despite >> errors) are you able to compile all the Ada examples other than the >> second one? If the issue is confined to just one of our examples, then >> it is much more likely a PLplot Ada issue with that example (or the >> API tested with that example) as you have suggested. > > Sorry, yes it is 4.8. Fedora is very tight with gcc development so we > get things early - fun! > > The example compiles fine, it just doesn't run. Some others don't run > either (see below). > > It looks very much like a floating point overflow condition is being > triggered. With a debug statement it aborts at the start of the loop: > > i = 0 r1 = 3.00000000000000E-01 > > I suspect that: > > 138 r(i+16) := Integer((r1 * 255.001) - 0.499999999999999); > > Has too many digits to be properly expressed. The comments indicate > that it is dealing with some rounding/truncating differences. I suspect > that gcc in 4.8 traps these conditions by default. > > Others: > > raised CONSTRAINT_ERROR : x02a.adb:141 overflow check failed > raised CONSTRAINT_ERROR : x03a.adb:92 overflow check failed > raised CONSTRAINT_ERROR : plplot_thin.adb:179 overflow check failed > raised CONSTRAINT_ERROR : x12a.adb:105 overflow check failed > raised CONSTRAINT_ERROR : x13a.adb:73 overflow check failed > raised CONSTRAINT_ERROR : x14a.adb:218 overflow check failed > raised CONSTRAINT_ERROR : plplot_thin.adb:179 overflow check failed > raised CONSTRAINT_ERROR : x18a.adb:156 overflow check failed > raised CONSTRAINT_ERROR : x19a.adb:192 overflow check failed > raised CONSTRAINT_ERROR : plplot_thin.adb:241 overflow check failed > raised CONSTRAINT_ERROR : plplot_auxiliary.adb:40 overflow check failed > raised CONSTRAINT_ERROR : xthick02a.adb:136 overflow check failed > raised CONSTRAINT_ERROR : xthick03a.adb:92 overflow check failed > raised CONSTRAINT_ERROR : xthick12a.adb:104 overflow check failed > raised CONSTRAINT_ERROR : xthick13a.adb:73 overflow check failed > raised CONSTRAINT_ERROR : xthick14a.adb:218 overflow check failed > raised CONSTRAINT_ERROR : xthick18a.adb:155 overflow check failed > raised CONSTRAINT_ERROR : xthick19a.adb:192 overflow check failed >
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. Jerry ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel