From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6c7dea22b75ba442 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: Colossus.Pike@worldnet.att.net (anon) Subject: Re: ada compiler? Reply-To: anon@anon.org (anon) References: <1194747665.6151.31.camel@K72> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Mon, 12 Nov 2007 05:13:50 GMT NNTP-Posting-Host: 12.64.114.137 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1194844430 12.64.114.137 (Mon, 12 Nov 2007 05:13:50 GMT) NNTP-Posting-Date: Mon, 12 Nov 2007 05:13:50 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:18294 Date: 2007-11-12T05:13:50+00:00 List-Id: -- -- This will answer a few statements: -- -- Georg Bauhaus and Jeffrey R. Carter := There is an specific answer -- at the bottom for you two. -- -- -- Jeffrey Creem := Your answer is almost at the bottom. -- -- -- a.adb -- -- -- The Error in using "-gnato" is that it does not work for all -- types as demonstrated in this example. "-gnato"? Is it a trick -- or a treat that Adacore coded into its compilers. -- with Ada.Text_IO ; with Ada.Float_Text_IO ; procedure a is Z : float := 0.0 ; A : float := 1.0 ; B : float := 2.0 ; C : float := 3.0 ; begin Ada.text_io.put_line ( "Perform Divide by Zero" ) ; -- -- This code does a divide by zero. The compiler uses the FPU -- instructions. And since the code can not generate a -- divide-by-zero error or exception or hardware interrupt, there -- will never be a Constraint_Error generated. -- -- Also, there is no pragma or command line option that will -- generated the code to detect this error condition for real -- number types. -- B := A / Z ; Ada.text_io.put_line ( " Done" ) ; Ada.text_io.put_line ( "Validate before perform a Divide" ) ; -- -- The only way to detect this error is for the programmer to learn -- to write a higher integrity form of code. Which is a type of -- learning and debugging feature that is build-in to Ada. This -- feature aids the programmer to write high efficient code. And -- not just allow bad coding with extra compiler generated checks -- that tries to correct the programmer's coding errors. -- -- Special Note: Ada aids a programmer in writing code but no -- Ada options or pragma should be use to replace -- integrity or efficiency in write programs. -- if B'Valid then if Z /= 0.0 then C := B / Z ; else Ada.text_io.put_line ( "Divide-By-Zero was attempted" ) ; end if ; else Ada.text_io.put_line ( "Invalid Data has been detected" ) ; end if ; -- -- User can even print the invalid data! In any method you like. -- Ada.text_io.new_line ; -- -- Just for those who like the IMAGE attribute -- Ada.text_io.put_line ( "B (image) := " & Float'Image ( B ) ) ; -- Ada.text_io.put ( "B (io package) := " ) ; Ada.Float_Text_IO.put ( B, 5, 2 ) ; Ada.text_io.new_line ; -- -- Look MOM! No EXCEPTIONS! -- Ada.text_io.put_line ( "End of Job" ) ; end ; -- -- Since the "-gnato" does not check for Real numbers I bet some -- one will suggest that this should be reported to Adacore. -- -- If you look in the language RM you can Restrict or Suppress -- coding but there is no standard pragma that causes the -- compiler to generated extra checking code. With that said, -- the Ada standard does not recommend the use of GNAT's "-gnato" -- for Ada implementation coding scheme, which can violate language -- integrity. -- -- -- Now for Ada Defaults: -- -- NOTE: Most users want to use the code just out of the box like they -- do with close source code. This is a MAJOR problem for open -- source. Users forget they can, but they will be using a low -- level vendor defaulted version. These defaulted versions -- are set to work with a wide range of software and hardware -- configurations. Even if that hardware and software is outdate -- and no longer supported. But to get the true power from an -- open source project, the source code must be recompiled (this -- include the Linux Kernel). And before rebuilding the binaries -- the user or company or etc. can customize the default -- operating code for the type of job or jobs that will be done. -- This also allows any outdated code to be removed or moved -- into special section or directory or into a set of special -- outdated hardware packages for Ada. -- -- Note: Most Code Convention and Practices rules does not allow the -- end user to modify the code. This is a close source rule, -- because it is ILLEGAL to modify close source code. This rule -- should be updated to reflect the use of open source and the -- GPL which allows customizing and modification of its source. -- Which allow the software to be optimized and specificity -- built for the job to be done. Giving an edge over the close -- source software vendors as well as the users competitors. -- -- Note: Actually, most system analysts will tell you that even close -- source code needs to be fine tune to the job they are set up -- to do. This goes for Microsoft operating system Windows (all -- version) as well as others. -- -- Note: System Software Engineers, know that the software needs to be -- check for optimization, package validity and fine tuning may -- be needed. That's one reason why on new system you get an OEM -- version of the operating system that is set up for that -- pre-installed computer hardware. Also it makes it hard to copy -- and to install on other hardware. -- -- -- Now to install the correct version of GNAT Ada (Linux): -- -- Note: This is stated on a number of Adacore and GNAT source files -- as well as a few web sites. With limited instructions, this -- version just hits the highlights. -- -- 1 => Install a temporary binary version aka older version of -- GNAT or other Ada compiler. Such as Adacore's GNAT 2007 -- GPL LIBC 2.3. -- -- Note: Currently most people are using GCC LIBC 3.2.x or 4.1.x -- Or people can get An Ada version for their GCC LIBC 4.x.x -- from either their Linux Vendor archives or in some cases -- sourceforge or other places may be available. -- -- NOTE: This is where most people stop. Which all GNAT versions are -- set to the defaults and GNAT is set to academic default -- version only. For schools, this is great but for the -- non-academic programming uses this is not. Another reason -- why Adacores suggests the move to GNAT PRO. -- -- For the non-academic programmer needs: -- -- 2 => Install the current GCC source packages, at least the -- "gcc-core" source package. -- 3 => Install the current GNAT source into the GCC source tree. -- -- Note: If you installed the complete GCC source instead of just -- the core it may contain the current version of GNAT. Or -- you may need to replace it and perform any patches if -- needed. -- -- 4 => Set the correct Default and Integrity mode that you need -- need for work. They are a few web sites and books that can -- help you decide on how to do this. And this does not change -- Ada just how the compile will perform and how the user will -- be requires to write code, including style may be set. -- -- Note: There are others facts that can be address here as well. -- Such as cross-compiling libraries, etc. -- -- 5 => Follow GCC build instructions for languages including Ada -- that you want. Time: 2 to 12+ hours. Time depends on a number -- of factors such as cpu speed and the number of language -- packages installed to be compiled such as -- C / Ada / JAVA / FORTRAN. -- Another reason is that the core system and libraries will be -- compiled in a number of 3 stages at the movement to optimize -- the code. And this can includes Ada as well. -- -- 6 => Uninstall and Remove Temporary Ada and older version of C -- and other packages if needed. -- 7 => Install newly build versions. Either complete C / Ada / etc -- or just Ada. -- 8 => Use the new system. -- -- For GNAT PRO: (For Jeffrey Creem) -- 1 => Install stocked GNAT PRO binary and source -- 2 => Install any compiler packages that are required by GNAT PRO -- to rebuild system. -- 3 => Set the correct Default and Integrity mode that you need -- for work. Most company do not want to spend the time to -- configure and rebuild GNAT and GNAT PRO. But a lot are -- learning they should when it comes to open source. -- 4 => Rebuild GNAT PRO -- 5 => Remove stocked version and reinstall updated version. -- -- Note: I have never seen a installed GNAT PRO that was not modified. -- -- Also, since in a previous reply post you kind of suggested that you -- are a student. Try this! Copy a test program to a test directory -- and also copy system.ads to this directory. Find and alter -- -- High_Integrity_Mode : constant Boolean := False; -- -- or add -- -- High_Integrity_Mode : constant Boolean := True; -- -- in the private section of system.ads. The GNAT compiler reads -- those Boolean statement after it processes the command line. -- -- Adacores states the High_Integrity_Mode is obsolete but it is -- still built into the compiler. Compile the test program. Resolve -- any binding errors by copying the package and recompile aka -- rebuilding the RTS with High_Integrity_Mode option set. For -- the "isitada" program its only 33 packages. You will find that -- Ada.Text_IO and the program "isitada" and a few other packages -- that uses the exception statement will have to be rewritten. -- Because in EXTREME HIGH INTEGRITY the exception statements and -- handlers are illegal to use. -- -- -- -- For ( Georg Bauhaus and Jeffrey R. Carter) -- -- It seams that Adacores is trying to destroy the learning -- and teaching ability that was incorporated into Ada. With -- the usage of its command line and GNAT special compiler -- commands, like "-gnato". I have said in another post that -- Adacore is one of many that is trying to Kill and Destroy -- the nature of Ada. -- -- SIDE NOTE: If you alter either or both SYSTEM private statements -- -- Backend_Divide_Checks : constant Boolean := False; -- Backend_Overflow_Checks : constant Boolean := False; -- -- to True, which is done in some default systems will -- disable the "gnato". Of course you will need to -- recompile language packages. So, the use of "-gnato" -- is not guarantee to work properly on all system. -- Which Ada RM suggest that you reject this type of -- concept. -- -- The Ada compiler was never design to allow the use command line -- to alter the coding of the source code, it should only identify -- the source files to be compile and libraries files for compiling, -- else some of the compiler options would be defined in the Ada -- LRM. The Ada manual does touch on the idea that implementation -- can use a 'nonstandard mode'. [ 1.1.5 ( 11 ) ]. But these are for -- setting limits on processing excessive warning or errors. Setting -- compiler special optimizations code and provides for alternative -- algorithms aka "-RTS=", "-nostdinc", "-nostdlib" command line -- options. Which allows different runtime packages and algorithms -- to be used without altering the source code. Plus, adding -- compiler generated code can lead to inefficiencies in the code -- which Ada RM suggests that concept should be rejected. -- -- Why is optimizations not a part of the Ada standard mode as define -- in LRM [ 1.1.5 ( 11 ) ]. Because if a programmer created a more -- efficient and integrity algorithm then increasing the compiler -- optimizations is a waste of time. No real improvement in the code -- efficiency. Plus, in most case the optimization routines alters -- the true nature of the algorithm. Also, in a few cases the compiler -- optimizations does decrease the efficiency of an algorithm. So, -- by the concept explain in LRM [ 1.1.5 ( 11 ) ] the usage -- optimization by the compiler should be avoided as well. -- -- The linker may have its own requirements. Ada language provide a -- method for that by using the "pragma Linker_Options" statement -- [ B.1 (8-9) ] without use a command line. And comments should be -- added to explain the reason for each option and how it effect the -- partition. That way if the reason is no longer valid then the -- software maintainer can remove or comment out this option, without -- altering the compile or algorithm integrity. -- -- What I am saying is use the following: -- -- pragma Linker_Options ( "-fstack-check" ) ; -- -- statement instead of command line. But this feature is not for -- the newbees programmer just learning Ada. Plus if you write an -- efficiency code you do not need to to have routines for checking -- either the primary or secondary stacks. -- -- As for the use of the "gnat compile" [ "gnat1" ] then "gnat bind" -- and then "gnat link" instead of using "gnatmake" well I refer -- you to paragraph 10 in the LRM "Design Goal" section at the first -- of the LRM. "gnatmake is a resource hog" while using the either -- gnat or gnat sub packages requires less resources. With that -- stated you should, in the case of GNAT, use the sub packages to -- conform to the Ada standards aka the LRM. -- -- And in a similar way that paragraph may also explain why Ada 2005 -- is not being accepted by other vendors. Some of the new -- constructs and packages are a concern that they lead Ada to -- inefficiencies in it coding. -- -- Plus, have you seen some of the gcc command line options used -- for other languages. Even in compiling GNAT Ada the gcc command -- line needs to be shorted. -- -- ---------------------------------------------------------------- -- -- So what I am saying use Ada to help you learn to write higher -- -- integrity and more efficient code. That meets the true nature -- -- of the Ada standards. And until you do, insert comments and -- -- pragmas like the "Linker_Options" pragma. Such as: -- -- -- -- pragma Linker_Options ( "-fstack-check" ) ; -- -- -- -- with comments to help you create a fix. Because this type of -- -- problem and the use of "-fstack-check" solution is not always -- -- portable to all Ada systems. And this type of statement allows -- -- others to understand that, so they may need to create a fix, or -- -- to work around it. But using command line options defeats some -- -- of the purposes that you use Ada in the first place. -- -- ---------------------------------------------------------------- -- In <1194747665.6151.31.camel@K72>, Georg Bauhaus writes: > >On Sun, 2007-11-11 at 01:01 +0000, anon wrote: >> how many beginners first downloads a GNAT version that requires: >> >> gnatmake -gnato -fstack-check .adb >> >> to compile a simple program! > >Wouldn't this be even more evidence in favor of having >-gnato -fstack-check on by default? If someone begins >learning Ada and then notices that the promised overflow >checking doesn't take place, what will be the reaction? >Also, what is the effect of an Ada compiler on the perception >of the language if, by default, stack overflow (e.g. due to >massive recursion without TCE) causes segmentation >violations rather than Storage_Error? What if we are told >that this or that is an operating system issue and that we >should learn how to adjust OS resources (ulimit etc.) so that >GNAT's produce works according to expectations? > >OTOH, -gnato renders the speed race among languages more >promising, and -fstack-check is a common gcc option. > >What should the default choices of gnatmake be then? > >