[Soot-list] variable name conflict

Bodden, Eric eric.bodden at sit.fraunhofer.de
Fri Jul 12 04:22:41 EDT 2013


I am sorry but I fail to see the problem. Can you please explain it again?

>From what I can see, there are three *different* locals that happen to have been assigned the same name. In the object representation of Jimple this should be no problem. (I can see that it looks odd, though, when the code is printed.)

Cheers,
Eric


On 04.07.2013, at 19:17, Sergio Ferrero <sferrero at ensoftcorp.com> wrote:

> 
> I found that Soot does not properly support the case in which the same variable name is declared in different java blocks.
> 
> I created an example in which a variable named "x" is used in different blocks:
> 
> package soot.test;
> 
> public class Locals {
> 	public void testDeclarations() {
> 		
> 		// Block 1
> 		{
> 			String x = "hello";
> 		}
> 
> 		// Block 2
> 		{
> 			char x = 'a';
> 		}
> 
> 		// Block 3
> 		for (int x = 0; x < 10; x++) {
> 			
> 		}
> 	}
> }
> 
> I generated Jimple code using the Soot's eclipse plugin by right clicking on the file and selecting 
> "Soot->Process Source File->Create Jimple"
> 
> The generated Jimple code redefines the variable with the same name three times in the method body. If I check all use and def boxes for the local variables, only the last variable definition is the one taken into account, that is "int x". The other definitions of "x" are never use in any value box.
> Below is the Jimple code for the testDeclarations() method.
> 
>     public void testDeclarations()
>     {
>         soot.test.Locals this;
>         java.lang.String x;
>         char x;
>         int x, temp$0, temp$1;
> 
>         this := @this: soot.test.Locals;
>         x = "hello";
>         x = 97;
>         x = 0;
> 
>      label0:
>         nop;
>         if x < 10 goto label1;
> 
>         goto label2;
> 
>      label1:
>         nop;
>         nop;
>         temp$0 = x;
>         temp$1 = temp$0 + 1;
>         x = temp$1;
>         goto label0;
> 
>      label2:
>         nop;
>         return;
>     }
> 
> Is this a bug in Soot or is there any Soot option I need to change to properly support this use case?
> 
> Thanks
> Sergio
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering  at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt



More information about the Soot-list mailing list