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 648890 - It's possible to attempt to use a value from a void expression, even though C doesn't allow this.
It's possible to attempt to use a value from a void expression, even though C...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.12.x
Other Linux
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
trivial-patch invalid-c-code
Depends on:
Blocks:
 
 
Reported: 2011-04-28 18:31 UTC by clinton
Modified: 2011-04-30 15:46 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description clinton 2011-04-28 18:31:24 UTC
To reproduce:

1) Compile the following Vala program:

   //----------------
   void glitch(void *vp) {
   	int i = (int)(*vp);
   	stderr.printf("\ni = %d.\n", i);
   }

   int main()
   {
   	int i = 4;
   	glitch(&i);
   	return 0;
   }
   //----------------

and observe the error returned from the C compiler.

Observed: valac accepts this program, generating invalid C code (error: invalid use of void expression).

Expected: valac displays an error message informing the user that trying to extract a value from a void expression is forbidden.
Comment 1 Luca Bruno 2011-04-30 15:46:20 UTC
commit 19d32a9e196a0e78be1721c5add06cf6c8174f21
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Sat Apr 30 17:42:00 2011 +0200

    Forbid pointer indirection for void type
    
    Fixes bug 648890.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.