llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.32k stars 12.12k forks source link

Failure to correctly identify compile-time constant #5948

Closed llvmbot closed 14 years ago

llvmbot commented 15 years ago
Bugzilla Link 5576
Resolution INVALID
Resolved on Feb 22, 2010 12:55
Version 2.6
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

Compiler reports:

../../../brlcad/src/liboptical/sh_billboard.c:117:41: error: initializer element is not a compile-time constant struct bu_structparse bbd_parse_tab[] = {

on the following code:

109 struct bu_structparse bbd_print_tab[] = { 110 {"%ld", 1, "w", SHDR_O(img_width), BU_STRUCTPARSE_FUNC_NULL }, 111 {"%ld", 1, "n", SHDR_O(img_height), BU_STRUCTPARSE_FUNC_NULL }, 112 {"%d", 1, "t", SHDR_O(img_threshold), BU_STRUCTPARSE_FUNC_NULL }, 113 {"%f", 1, "h", SHDR_O(img_scale), BU_STRUCTPARSE_FUNC_NULL }, 114 {"%V", 1, "f", SHDR_O(img_filename), new_image }, 115 {"", 0, (char )0, 0, BU_STRUCTPARSE_FUNC_NULL } 116 }; 117 struct bu_structparse bbd_parse_tab[] = { 118 {"i", bu_byteoffset(bbd_print_tab[0]), "bbd_print_tab", 0, BU_STRUCTPARSE_FUNC_NULL }, 119 {"", 0, (char )0, 0, BU_STRUCTPARSE_FUNC_NULL } 120 };

The reference to bbd_print_tab[0] in line 118 seems to be identified as non-compile-time constant despite it being constant (removing that line allows the build to continue).

llvmbot commented 15 years ago

Need to define bu_byteoffset(_i) specifically for clang, apparently... can't test properly until that's worked out, so closing.