Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#59 unsafe declarations in generic specification scope

closed-fixed
David Gay
5
2010-07-31
2010-06-22
Peter A. Bigot
No

If a tagged type declaration in the component specification block of a generic component depends on a generic parameter, nesc generates code that substitutes the value of the generic parameter to the last instance of the component, rather than the value specific to a given instance. E.g., in the attached set of sources, the generated code correctly distinguishes two Protocol values, but both implementations of MyProtocol.protocol() return the same explicit constant. The problem arises from LcpAutomatonC.nc; excerpts from generated code are in WhatISee.txt.

Discussion

  • Peter A. Bigot
    Peter A. Bigot
    2010-06-22

    sources to reproduce problem

     
    Attachments
  • Peter A. Bigot
    Peter A. Bigot
    2010-06-30

    The same behavior occurs if the tagged value depends on an intrinsic; e.g. using:
    enum {
    NicId = unique(UQ_OIP_NETWORK_INTERFACE),
    };
    in the specification block allows NicId to be used in the implementation block, but all instances reference the last value generated by unique().

     
  • David Gay
    David Gay
    2010-07-31

    • status: open --> closed-fixed
     
  • David Gay
    David Gay
    2010-07-31

    Fixed in CVS.