due to this code fragment of ASG.py, working with the IR using str(template) when template has no defined name causes a crash.
class ParametrizedTypeId(TypeId):
[...]
def __str__(self):
return "%s<%s>"%('::'.join(self.template.name),
','.join([str(a) for a in self.parameters])) |
Thanks for the report !
The input is invalid ('MyUnknownPairType' is undefined). Ideally, this should result in a 'parse error'. However, historically there were cases where Synopsis wouldn't be able to lookup a symbol, even if it was correctly declared. Thus I didn't make this a hard failure.
I do think that the code you quote (ASG.py) is right, i.e. it should assume 'template' to be an existing object, not None.
Synopsis may abort with a parse error prior to generating the ASG. |
Hi,
c++ allows such definitions if the compiler is able to find the definition at compile time e.g template is defined before header include in the cpp file (here: defined in another header only included in cpp file).
i admit it is not a good coding style.
in this case, the code belongs to someone else and i would like to analyse it (here: create a Rose model)
Regards,
Tris
-------- Original-Nachricht --------
> Datum: Tue, 21 Apr 2009 13:57:49 +0000
> Von: Stefan Seefeld via synopsis issue tracker <issues@synopsis.fresco.org>
> An: hamster158-synopsis@yahoo.de, jsrinivasa@rambus.com, stefan@fresco.org, tris00@gmx.de
> Betreff: [bug156] synopsis aborts for str(template) if template has no name
>
> Stefan Seefeld <stefan@fresco.org> added the comment:
>
> Thanks for the report !
>
> The input is invalid ('MyUnknownPairType' is undefined). Ideally, this
> should result in a 'parse error'. However, historically there were cases where
> Synopsis wouldn't be able to lookup a symbol, even if it was correctly
> declared. Thus I didn't make this a hard failure.
>
> I do think that the code you quote (ASG.py) is right, i.e. it should
> assume 'template' to be an existing object, not None.
> Synopsis may abort with a parse error prior to generating the ASG.
>
> ----------
> assignedto: -> stefan
> nosy: +stefan
> status: new -> open
>
> ___________________________________________________
> Synopsis issue tracker <issues@synopsis.fresco.org>
> <http://synopsis.fresco.org/issues/bug156>
> ___________________________________________________ |
Hi,
enclosed you get the header, the cpp, the Formatter and a shell script calling the compiler and synopsis.
as you will see, the cpp compiles without any problems.
synopsis aborts with
[...]
File ".../Synopsis/ASG.py", line 200, in __str__
','.join([str(a) for a in self.parameters]))
File ".../Synopsis/ASG.py", line 199, in __str__
return "%s<%s>"%('::'.join(self.template.name),
AttributeError: 'NoneType' object has no attribute 'name'
as i wrote, i am not happy with this c++ programming "style"...
Regards,
Tris
-------- Original-Nachricht --------
> Datum: Wed, 22 Apr 2009 14:56:07 +0000
> Von: Stefan Seefeld via synopsis issue tracker <issues@synopsis.fresco.org>
> An: hamster158-synopsis@yahoo.de, jsrinivasa@rambus.com, stefan@fresco.org, tris00@gmx.de
> Betreff: [bug156] synopsis aborts for str(template) if template has no name
>
> Stefan Seefeld <stefan@fresco.org> added the comment:
>
> Sorry, no. The file you attached is not valid C++.
> Please turn that into a valid C++ file and that still makes Synopsis fail,
> and I will try to resolve the issue.
> Thanks !
>
> ___________________________________________________
> Synopsis issue tracker <issues@synopsis.fresco.org>
> <http://synopsis.fresco.org/issues/bug156>
> ___________________________________________________ |