After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660991 - Segfault when FloatingType misses rank
Segfault when FloatingType misses rank
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
0.35.x
Other Linux
: High minor
: 0.42
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-10-05 14:46 UTC by Ilya Mezhirov
Modified: 2018-05-14 10:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
valac -C --vapidir=. --pkg=foo foo.vala (277 bytes, application/x-gzip)
2011-10-05 14:46 UTC, Ilya Mezhirov
  Details
vala: Don't return null if no rank attribute was found (804 bytes, patch)
2018-05-14 09:10 UTC, Rico Tzschichholz
committed Details | Review

Description Ilya Mezhirov 2011-10-05 14:46:54 UTC
Created attachment 198344 [details]
valac -C --vapidir=. --pkg=foo foo.vala

I used to hack complex numbers into Vala by doing this:

[SimpleType]
[FloatingType]
[CCode(cheader_filename = "complex.h", cname = "complex double")]
public struct complex
{
}

Valgrind says:
Invalid read of size 4
  at 0x501D858: vala_struct_get_rank (in /usr/lib/libvala-0.14.so.0.0.0)
  by 0x501247C: vala_semantic_analyzer_get_arithmetic_result_type (in /usr/lib/libvala-0.14.so.0.0.0)

It seems that the correct way now is
[FloatingType(rank = 3)]

A error message would be nice.
Comment 1 Luca Bruno 2011-10-05 17:33:22 UTC
Thanks for your bug report. Not sure if we want a default value or an error there.
Comment 2 Rico Tzschichholz 2018-05-14 09:10:17 UTC
Created attachment 371991 [details] [review]
vala: Don't return null if no rank attribute was found

There was already an error message introduced with
3158ae7a0f990b44f114d51498636e669609af0d
Comment 3 Rico Tzschichholz 2018-05-14 10:00:35 UTC
Attachment 371991 [details] pushed as 5bdf8f5 - vala: Don't return null if no rank attribute was found