Re: [Jastadd] [bug report] two other bugs

From: Jesper Öqvist <jesper.oqvist_at_cs.lth.se>
Date: Fri, 04 May 2012 17:09:01 +0200

First bug was fixed in svn revision 9260.

Second bug was fixed in svn revision 9262.

/Jesper

On 04/30/2012 05:34 PM, Na, Hyunik wrote:
>
> Hello again,
>
> Bug.1.
>
> In EnhancedForCodegen.jrag in Java1.5Backend,
> EnhancedForStmt.createBCode() contains the following code:
>
> -=-=-=
>
> ?
>
> if (obj.type().isPrimitive()) {
>
> gen.emitCheckCast(obj.type().boxed());
>
> ?
>
> } else {
>
> ?
>
> }
>
> ?
>
> -=-=-=
>
> It seems that the condition of the if statement should be
>
> if ( obj.type().isPrimitiveType() ) {
>
> assert !obj.type().isUnknown();
>
> ?
>
> or
>
> if ( obj.type() instanceof PrimitiveType ) {
>
> ?
>
> because isPrimitive() is true also for a non-primitive type whose
> unboxed type is primitive.
>
> ( see the following definition of ReferenceType.isPrimitive() in
> AutoBoxing.jrag in Java1.5Frontend:
>
> eq ReferenceType.isPrimitive() = !unboxed().isUnknown() &&
> unboxed().isPrimitive(); )
>
> Because of the isPrimitve(), gen.emitCheckCast is called with the
> UnknownType as its argument when
>
> obj.type() is one of Double, Float, Long, Integer, etc.
>
> This produces a wrong constant pool entry
>
> const #... = Asciz _at_primitive/Unknown;
>
> in the class file for cases such as the following
>
> -=-=-= Test.java
>
> public class Test {
>
> void test( java.util.Set<Long> set ) {
>
> for ( Long l: set ) ;
>
> }
>
> }
>
> -=-=-=
>
> This problem was observed when compiling
>
> . com/sun/media/sound/DLSSoundbank.java
>
> . javax/management/timer/Timer.java
>
> . sun/security/pkcs11/Config.java
>
> from OpenJDK1.6
>
> Bug.2.
>
> When compiling the following code,
>
> -=-=-= Test.java
>
> public class Test {
>
> void test( int i ) {
>
> int j;
>
> assert i == (j=3) : (i + "!=" + j);
>
> }
>
> }
>
> -=-=-=
>
> JastAddJ wrongly produces the following error message.
>
> -=-=-=
>
> Errors:
>
> Test.java:7,37:
>
> Semantic Error: Local variable j in not assigned before used
>
> -=-=-=
>
> You can easily see that j is definitely assigned before used.
>
> Java spec. for definite assignment and DefiniteAssignment.jrag look
> quite complicated,
>
> and probably it will take long time for me to understand them and
> pin-point the problematic spot in the code.
>
> So, I just report the symptom in this e-mail. J
>
> ( The above example is a lot simplified and looks rather stupid.
>
> The real code in com/sun/java/util/jar/pack/CodingChooser.java is
>
> -=-=-=
>
> ?
>
> int size = c.getLength(values, start, end);
>
> int size2;
>
> assert(size == (size2=countBytesToSizer(cm, values, start, end))) :
> (cm+" : "+size+" != "+size2);
>
> return size;
>
> ?
>
> -=-=-=
>
> )
>
> Please check these.
>
> - Hyunik
>
>
> _______________________________________________
> JastAdd mailing list
> JastAdd_at_cs.lth.se
> https://mail1.cs.lth.se/cgi-bin/mailman/listinfo/jastadd
Received on Fri May 04 2012 - 17:08:21 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST