[Bug c/46073] New: __builtin_choose_expr outputs warnings for unused expression
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46073 Summary: __builtin_choose_expr outputs warnings for unused expression Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: kevin.wa...@gmail.com $ gcc -std=c99 -Wall -x c - << EOF void A(int * p) {} void B(double * p) {} int main() { int * p = 0; __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(p), int *), A(p), B(p)); return 0; } EOF : In function ‘main’: :5: warning: passing argument 1 of ‘B’ from incompatible pointer type $ gcc -v Using built-in specs. Target: i686-apple-darwin9 Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5493)
[Bug c/46073] __builtin_choose_expr outputs warnings for unused expression
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46073 --- Comment #2 from kevin.waugh at gmail dot com 2010-10-18 19:17:17 UTC --- (In reply to comment #1) > I think this is correct as __builtin_choose_expr still does semantically > checking on the two arguments. Not to mention __builtin_choose_expr was > added > only to support Altivec intrinsics and that has since been moved away from > that. >From the documentation: Note: This construct is only available for C. Furthermore, the unused expression (exp1 or exp2 depending on the value of const_exp) may still generate syntax errors. This may change in future revisions. What are the chances of getting this changed, or having an option to suppress warnings on the unevaluated argument? The implementation of tgmath.h is essentially using __builtin_choose_expr for the same purpose, but it appers to avoid any warnings/errors because of implicit casts.
[Bug other/49666] New: passing nested function to inline function causes a trampoline call
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49666 Summary: passing nested function to inline function causes a trampoline call Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: kevin.wa...@gmail.com #include static inline int identity(int (*f)()) { return f(); } int n = 0; int f() { return n; } int main() { int m = 0; int g() { return m; } printf("%d\n", identity(f)); /* inlines all the way */ printf("%d\n", identity(g)); /* calls g through trampoline */ printf("%d\n", g()); /* inline's g */ }