GNU bug report logs -
#41296
Fix misuse of "target_info" in default_target_compile (with patch)
Previous Next
Reported by: jcb62281 <at> gmail.com
Date: Fri, 15 May 2020 22:53:02 UTC
Severity: normal
Done: jcb62281 <at> gmail.com
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This patch fixes an interesting bug in default_target_compile: if the options set dest= prior to specifying a language, the language defaults are loaded incorrectly. Specifically, for each board_info value, the *existence* of that value is tested for the board specified using dest=, but the actual value is
read from the information for the current target. Since the current target is the default destination, the only reason to specify the dest= option is to override the current target, so this must be wrong and this patch fixes the bug.
[0008-Fix-misuse-of-target_info-in-default_target_compile.patch (text/plain, inline)]
From 9e163d9a322a4e5e452d4c610665ea3330de868b Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <jcb62281+dev <at> gmail.com>
Date: Fri, 31 May 2019 18:16:08 -0500
Subject: [PATCH 8/9] Fix misuse of "target_info" in default_target_compile
*ChangeLog entry:
* lib/target.exp (default_target_compile): Use the "board_info"
procedure correctly when loading language defaults, instead of
checking for each option under the $dest board, but reading the
value using "target_info", which uses the current target instead
of the target specified using the "dest=" option.
---
lib/target.exp | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/target.exp b/lib/target.exp
index a9ac83e..6a940af 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -337,10 +337,10 @@ proc default_target_compile {source destfile type options} {
if { $i eq "ada" } {
set compiler_type "ada"
if {[board_info $dest exists adaflags]} {
- append add_flags " [target_info adaflags]"
+ append add_flags " [board_info $dest adaflags]"
}
if {[board_info $dest exists gnatmake]} {
- set compiler [target_info gnatmake]
+ set compiler [board_info $dest gnatmake]
} else {
set compiler [find_gnatmake]
}
@@ -349,11 +349,11 @@ proc default_target_compile {source destfile type options} {
if { $i eq "c++" } {
set compiler_type "c++"
if {[board_info $dest exists cxxflags]} {
- append add_flags " [target_info cxxflags]"
+ append add_flags " [board_info $dest cxxflags]"
}
append add_flags " [g++_include_flags]"
if {[board_info $dest exists c++compiler]} {
- set compiler [target_info c++compiler]
+ set compiler [board_info $dest c++compiler]
} else {
set compiler [find_g++]
}
@@ -362,10 +362,10 @@ proc default_target_compile {source destfile type options} {
if { $i eq "d" } {
set compiler_type "d"
if {[board_info $dest exists dflags]} {
- append add_flags " [target_info dflags]"
+ append add_flags " [board_info $dest dflags]"
}
if {[board_info $dest exists dcompiler]} {
- set compiler [target_info dcompiler]
+ set compiler [board_info $dest dcompiler]
} else {
set compiler [find_gdc]
}
@@ -374,10 +374,10 @@ proc default_target_compile {source destfile type options} {
if { $i eq "f77" } {
set compiler_type "f77"
if {[board_info $dest exists f77flags]} {
- append add_flags " [target_info f77flags]"
+ append add_flags " [board_info $dest f77flags]"
}
if {[board_info $dest exists f77compiler]} {
- set compiler [target_info f77compiler]
+ set compiler [board_info $dest f77compiler]
} else {
set compiler [find_g77]
}
@@ -386,10 +386,10 @@ proc default_target_compile {source destfile type options} {
if { $i eq "f90" } {
set compiler_type "f90"
if {[board_info $dest exists f90flags]} {
- append add_flags " [target_info f90flags]"
+ append add_flags " [board_info $dest f90flags]"
}
if {[board_info $dest exists f90compiler]} {
- set compiler [target_info f90compiler]
+ set compiler [board_info $dest f90compiler]
} else {
set compiler [find_gfortran]
}
--
1.7.4.1
This bug report was last modified 4 years and 364 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.