This bug was uncovered while developing tests for default_target_compile. The procedure attempts to determine if a host is set using [info exists target_info(host,name)], but does not use the global target_info. As a result, the configuration for "unix" is used unconditionally. This is clearly a bug.

The only potential impact of this patch is that the cflags_for_target board_info parameter will now be correctly retrieved from the host board configuration instead of always from the "unix" board configuration. It is clear that this was the intent of the original code and doubtful that any testsuites are depending on the current broken behavior. (If anyone is working around this bug, we should have received complaints about default_target_compile ignoring the selected host. Had such complaints been received, this bug would have been fixed long ago, therefore no tests will be broken by this patch. I suspect that nearly all current use of DejaGnu is on "unix" hosts, thus camouflaging this bug very effectively.)

----
ChangeLog entry:
        * lib/target.exp (default_target_compile): Use "host_info"
        procedure to probe for a host configuration, instead of checking a
        local empty target_info array due to lacking "global target_info".
---
lib/target.exp |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/target.exp b/lib/target.exp
index 2620e30..9cc262d 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -326,7 +326,7 @@ proc default_target_compile {source destfile type options} {
        append ldflags " $LDFLAGS_FOR_TARGET"
    }

-    if {[info exists target_info(host,name)]} {
+    if {[host_info exists]} {
        set host [host_info name]
    } else {
        set host "unix"
----


-- Jacob

_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
https://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to