From: anon on 26 Jun 2010 17:04 In <0fa4c574-9539-492f-8514-d32c68beb22a(a)w31g2000yqb.googlegroups.com>, "lekktu(a)gmail.com" <lekktu(a)gmail.com> writes: >Well, it hasn't been hard to find the first bug. > >-------------------------------------------------------------------------------- >function Validate (Dir : in String) return String is >begin > return (if Dir (Dir'Last) = '\' then Dir else Dir & '\'); >end Validate; >-------------------------------------------------------------------------------- > >C:\test\> gnatmake -gnat12 validate.adb >gcc -c -gnat12 validate.adb >+===========================GNAT BUG >DETECTED==============================+ >| GPL 2010 (20100603) (i686-pc-mingw32) GCC >error: | >| in mostly_copy_tree_r, at gimplify.c: >893 | >| Error detected around C:/gnat/lib/gcc/i686-pc-mingw32/4.3.6/ >adainclude/s-stoele.ads:65| >| Please submit a bug report by email to >report(a)adacore.com. | >| GAP members can alternatively use GNAT >Tracker: | >| http://www.adacore.com/ section 'send a >report'. | >| See gnatinfo.txt for full info on procedure for submitting >bugs. | >| Use a subject line meaningful to you and us to track the >bug. | >| Include the entire contents of this bug box in the >report. | >| Include the exact gcc or gnatmake command that you >entered. | >| Also include sources listed below in gnatchop >format | >| (concatenated together with no headers between >files). | >| Use plain ASCII or MIME >attachment. | >+========================================================================== >+ > >Please include these source files with error report >Note that list may not be accurate in some cases, >so please double check that the problem can still >be reproduced with the set of files listed. >Consider also -gnatd.n switch (see debug.adb). > >validate.adb > >compilation abandoned >gnatmake: "validate.adb" compilation error > > >I'll submit a bug report. Now, to compile the Ada system this statement type must work because it is embeded in a number of locations in the Ada.Text_IO.adb and other Ada system packages. So, first, try compiling without the "-gnat12" switch. Second, try the routine without the concatenation operator "&" or try to return a static string or a substring. Then again this statement may be limited to numerical, characters type values only. If that does not work try copying "a-textio.ad*" to a local temp dir and compile it by: gcc -c -gnatpg a-textio.adb You should get no errors, only a warning that your states your recompiling the a system package. Last, if you have or still have GNAT 2009 try compiling using 2009: gnatmake ....
From: lekktu on 26 Jun 2010 17:41 On Jun 26, 11:04 pm, a...(a)anon.org wrote: > Now, to compile the Ada system this statement type must work because it > is embeded in a number of locations in the Ada.Text_IO.adb and other > Ada system packages. Yes. Conditional expressions do not fail everywhere. In this specific case, both Dir & '\' and the fact that Dir is a function argument are required to trigger the bug. > So, first, try compiling without the "-gnat12" switch. [...] > Last, if you have or still have GNAT 2009 try compiling using 2009: I've already reported the bug, so I'll let them (AdaCore) do the debugging...
From: Dmitry A. Kazakov on 26 Jun 2010 17:42 On Sat, 26 Jun 2010 05:04:10 -0700 (PDT), lekktu(a)gmail.com wrote: > Well, it hasn't been hard to find the first bug. > > -------------------------------------------------------------------------------- > function Validate (Dir : in String) return String is > begin > return (if Dir (Dir'Last) = '\' then Dir else Dir & '\'); > end Validate; > -------------------------------------------------------------------------------- [...] > I'll submit a bug report. (Yes, to remove that abomination from the language! (:-)) I didn't read the AI, but your code looks very strange to me. Isn't its syntax exposed to the infamous Pascal-if flaw? I mean, where is the "end if"? Is this legal: (if A then X else if B then Y else Z) P.S. Is case allowed too? P.P.S. Didn't they forget the return statement? It would be great "fun" to write and read this: if return X : Boolean do declare ... begin ... end: end return; then ... if; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: lekktu on 26 Jun 2010 18:01 On Jun 26, 11:42 pm, "Dmitry A. Kazakov" <mail...(a)dmitry-kazakov.de> wrote: > (Yes, to remove that abomination from the language! (:-)) I don't like it much, but I don't like if A then V := X; else V := Y; end if; that much either. > I didn't read the AI, but your code looks very strange to me. Isn't its > syntax exposed to the infamous Pascal-if flaw? I mean, where is the "end > if"? Is this legal: > > (if A then X else if B then Y else Z) Read the AI. IIRC, parenthesis are usually required, so (if A then X else (if B then Y else Z)), but the rules for parenthesis are relaxed in some contexts, like function arguments, so "F (if A then X else Y);" instead of "F ((if A then X else Y));". > P.S. Is case allowed too? I think so, yes. > P.P.S. Didn't they forget the return statement? It would be great "fun" to > write and read this: > > if return X : Boolean do > declare > ... > begin > ... > end: > end return; > then > ... > if; Very funny... sort of.
From: anon on 26 Jun 2010 23:33 In <bb9c5de5-f9ee-4388-9bc0-667cf4372287(a)u26g2000yqu.googlegroups.com>, "lekktu(a)gmail.com" <lekktu(a)gmail.com> writes: >On Jun 26, 11:04=A0pm, a...(a)anon.org wrote: > >> Now, to compile the Ada system this statement type must work because it >> is embeded in a number of locations in the Ada.Text_IO.adb and other >> Ada system packages. > >Yes. Conditional expressions do not fail everywhere. In this specific >case, both Dir & '\' and the fact that Dir is a function argument are >required to trigger the bug. > >> So, first, try compiling without the "-gnat12" switch. >[...] >> Last, if you have or still have GNAT 2009 try compiling using 2009: > >I've already reported the bug, so I'll let them (AdaCore) do the >debugging... The compiler blowing up is an error, but, there are always a way around that type of error, if you find the correct syntax. Try adding parenthesis around the output, since the compiler may see the "Dir" as value and the " & '\'" as extra not part of the statement. function Validate (Dir : in String) return String is begin return (if Dir (Dir'Last) = '\' then Dir else (Dir & '\')); end Validate; And until the Ada2012 RM or documentation/examples come out from Adacore, its anyone guess on the true syntax of all additional statements. Unless you want to spend time in reading the though the gnat Ada compiler. now, in taking a quick look at "par_ch4.adb", Adacore did add that "gnat12" only switch to use the following features: 1. conditional expression -- statement must be parenthesized. (if X then Opt1 else Opt2) where Opt1 and Opt2 must be a function or variable -- the following two addition are not in the documentation, yet! 2. case expression -- statement must be parenthesized. assuming syntax is like conditional expression (case X when Opt1 => Val1 when Opt2 => Val2 when others => Val2) where Val1 and Val2 must be a function or variable 3. from RM 4.5.2 Relational Operators and Membership Tests Now allows the use of "Vertical_Bar" in Membership Tests assuming from code syntax N in X .. Y | A .. B | G .. K
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Test; Please Ignore Next: Press Release - Ada-Europe launches Programming Contest |