Patchwork [Ada] gnatmake crashes with -cargs -m -margs -m

login
register
mail settings
Submitter Arnaud Charlet
Date March 19, 2012, 4:41 p.m.
Message ID <20120319164139.GA24632@adacore.com>
Download mbox | patch
Permalink /patch/147578/
State New
Headers show

Comments

Arnaud Charlet - March 19, 2012, 4:41 p.m.
This patch ensures that gnatmake no longer crashes when there are -m
switches after -cargs and after -margs on the command line.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-03-19  Vincent Celier  <celier@adacore.com>

	* make.adb (Scan_Make_Arg): Make sure all significant -m switches
	on the command line are counted.

Patch

Index: make.adb
===================================================================
--- make.adb	(revision 185520)
+++ make.adb	(working copy)
@@ -7423,6 +7423,16 @@ 
 
          Add_Switch (Argv, Program_Args, And_Save => And_Save);
 
+         --  Make sure that all significant switches -m on the command line
+         --  are counted.
+
+         if Argv'Length > 2
+           and then Argv (1 .. 2) = "-m"
+           and then Argv /= "-mieee"
+         then
+            N_M_Switch := N_M_Switch + 1;
+         end if;
+
       --  Handle non-default compiler, binder, linker, and handle --RTS switch
 
       elsif Argv'Length > 2 and then Argv (1 .. 2) = "--" then