]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
work around QCC STORE_V bug
authorRudolf Polzer <divverent@xonotic.org>
Wed, 2 May 2012 08:27:31 +0000 (10:27 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 2 May 2012 08:27:31 +0000 (10:27 +0200)
misc/tools/progs-analyzer.pl

index a6528d2bfe7bc1f515b08e531ebda310b2921e78..95a66132abfaad2ed3299fa825e7b0e58e72a51e 100644 (file)
@@ -661,8 +661,18 @@ sub find_uninitialized_locals($$)
                        my ($ip, $state, $s, $c) = @_;
                        my $op = $s->{op};
 
+                       # QCVM BUG: RETURN always takes vector, there is no float equivalent
                        my $return_hack = $c->{isreturn} // 0;
 
+                       if($op eq 'STORE_V')
+                       {
+                               # COMPILER BUG of QCC: params are always copied using STORE_V
+                               if($s->{b} >= 4 && $s->{b} < 28) # parameter range
+                               {
+                                       $return_hack = 1;
+                               }
+                       }
+
                        for(qw(a b c))
                        {
                                my $type = $c->{$_};
@@ -681,7 +691,8 @@ sub find_uninitialized_locals($$)
                                        my $valid = $state->{$ofs}{valid};
                                        if($valid->[0] == 0)
                                        {
-                                               if($return_hack <= 2 and ($op ne 'OR' && $op ne 'AND' || $_ ne 'b')) # fteqcc logicops cause this
+                                               # COMPILER BUG of FTEQCC: AND and OR may take uninitialized as second argument (logicops)
+                                               if($return_hack <= 2 and ($op ne 'OR' && $op ne 'AND' || $_ ne 'b'))
                                                {
                                                        print "; Use of uninitialized value $ofs in $func->{debugname} at $ip.$_\n";
                                                        ++$warned{$ip}{$_};
@@ -689,7 +700,8 @@ sub find_uninitialized_locals($$)
                                        }
                                        elsif($valid->[0] < 0)
                                        {
-                                               if($return_hack <= 2 and ($op ne 'OR' && $op ne 'AND' || $_ ne 'b')) # fteqcc logicops cause this
+                                               # COMPILER BUG of FTEQCC: AND and OR may take uninitialized as second argument (logicops)
+                                               if($return_hack <= 2 and ($op ne 'OR' && $op ne 'AND' || $_ ne 'b'))
                                                {
                                                        print "; Use of temporary $ofs across CALL in $func->{debugname} at $ip.$_\n";
                                                        ++$warned{$ip}{$_};