473,657 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array has incomplete element type. GCC bug?

Hi everyone,

I'm currently struggling to compile a large piece of legacy code. GCC
3.3 compiles it without complaining, but GCC 4.2.3 (the default in
Debian) refuses it and signals "several array has incomplete element
type" errors.

I know that since 4.0 or so, GCC is less forgiving and does not accept
any arrays of incomplete type (see http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html).
However, I cannot see where the array types are incomplete here:

/* From the header */
void grphcs_enhnc_ou tsquare(unsigne d char [][], const int, const int,
const int, const int y);

/* From the source: ERROR: Array type has incomplete element type */
void grphcs_enhnc_ou tsquare(unsigne d char outsquare[][], const int w,
const int h, const int x, const int y)
{ /* ... */ }

/* From another header */
extern void bz_comp(int, int [], int [], int [], int *, int [][], int
*[]);

/* From the corresponding source: ERROR: Array type has incomplete
element type */
void bz_comp(
int npoints,
int xcol[ MAX_BOZORTH_MIN UTIAE ],
int ycol[ MAX_BOZORTH_MIN UTIAE ],
int thetacol[ MAX_BOZORTH_MIN UTIAE ],

int * ncomparisons,
int cols[][ COLS_SIZE_2 ],
int * colptrs[]
)
{ /* ... */ }
Can anyone shed some light?

Thanks in advance
- Arcadio
Jun 27 '08 #1
10 7620
In comp.lang.c, arcadio wrote:
Hi everyone,

I'm currently struggling to compile a large piece of legacy code. GCC
3.3 compiles it without complaining, but GCC 4.2.3 (the default in
Debian) refuses it and signals "several array has incomplete element
type" errors.
[snip]
/* From the corresponding source: ERROR: Array type has incomplete
element type */
void bz_comp(
int npoints,
int xcol[ MAX_BOZORTH_MIN UTIAE ],
int ycol[ MAX_BOZORTH_MIN UTIAE ],
int thetacol[ MAX_BOZORTH_MIN UTIAE ],

int * ncomparisons,
int cols[][ COLS_SIZE_2 ],
How many cols elements are in this array? How can the compiler determine
that number?
int * colptrs[]
)
{ /* ... */ }
Can anyone shed some light?

Thanks in advance
- Arcadio
--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Jun 27 '08 #2
arcadio said:

<snip>
However, I cannot see
where the array types are incomplete here:

/* From the header */
void grphcs_enhnc_ou tsquare(unsigne d char [][]
^^^^
Right here.

Regarding your subject line, "Array has incomplete element type. GCC bug?",
it is generally wisest in the first instance[1] to assume that the bug is
in your code unless you can demonstrate from the Standard that your code
is correct.

[1]...and the second instance, and the third...

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #3
arcadio wrote:
Hi everyone,

I'm currently struggling to compile a large piece of legacy code. GCC
3.3 compiles it without complaining, but GCC 4.2.3 (the default in
Debian) refuses it and signals "several array has incomplete element
type" errors.

I know that since 4.0 or so, GCC is less forgiving and does not accept
any arrays of incomplete type (see http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html).
However, I cannot see where the array types are incomplete here:

/* From the header */
void grphcs_enhnc_ou tsquare(unsigne d char [][], const int, const int,
const int, const int y);

/* From the source: ERROR: Array type has incomplete element type */
void grphcs_enhnc_ou tsquare(unsigne d char outsquare[][], const int w,
const int h, const int x, const int y)
{ /* ... */ }

/* From another header */
extern void bz_comp(int, int [], int [], int [], int *, int [][], int
*[]);

/* From the corresponding source: ERROR: Array type has incomplete
element type */
void bz_comp(
int npoints,
int xcol[ MAX_BOZORTH_MIN UTIAE ],
int ycol[ MAX_BOZORTH_MIN UTIAE ],
int thetacol[ MAX_BOZORTH_MIN UTIAE ],

int * ncomparisons,
int cols[][ COLS_SIZE_2 ],
int * colptrs[]
)
{ /* ... */ }
Can anyone shed some light?

Thanks in advance

extern void
bz_comp(int, int [], int [], int [], int *,
int [][COLS_SIZE_2], int *[]);

--
pete
Jun 27 '08 #4
On 23 jun, 17:59, Lew Pitcher <lpitc...@teksa vvy.comwrote:
In comp.lang.c, arcadio wrote:
Hi everyone,
I'm currently struggling to compile a large piece of legacy code. GCC
3.3 compiles it without complaining, but GCC 4.2.3 (the default in
Debian) refuses it and signals "several array has incomplete element
type" errors.
[snip]
/* From the corresponding source: ERROR: Array type has incomplete
element type */
void bz_comp(
int npoints,
int xcol[ * * MAX_BOZORTH_MIN UTIAE ],
int ycol[ * * MAX_BOZORTH_MIN UTIAE ],
int thetacol[ MAX_BOZORTH_MIN UTIAE ],
int * ncomparisons,
int cols[][ COLS_SIZE_2 ],

How many cols elements are in this array? How can the compiler determine
that number?
int * colptrs[]
)
{ /* ... */ }
Can anyone shed some light?
Thanks in advance
- Arcadio

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576http://pitcher.digital freehold.ca/* | GPG public key available by request
---------- * * *Slackware - Because I know what I'm doing. * * * * *------
The error is not there, it's:

/* From the header */
void grphcs_enhnc_ou tsquare(unsigne d char **, const int, const int,
<-- transform into pointers
const int, const int y);

/* From the source: ERROR: Array type has incomplete element type */
void grphcs_enhnc_ou tsquare(unsigne d char **outsquare, const int w,
<-- transform into pointers
const int h, const int x, const int y)
{ /* ... */ }

/* From another header */
extern void bz_comp(int, int [], int [], int [], int *, int []
[COLS_SIZE_2], int <- constant needed
*[]);

/* From the corresponding source: ERROR: Array type has incomplete
element type */
void bz_comp(
int npoints,
int xcol[ MAX_BOZORTH_MIN UTIAE ],
int ycol[ MAX_BOZORTH_MIN UTIAE ],
int thetacol[ MAX_BOZORTH_MIN UTIAE ],

int * ncomparisons,
int cols[][ COLS_SIZE_2 ],
int * colptrs[]
)
{ /* ... */ }
Jun 27 '08 #5
In article <6d************ *************** ***@bt.com>,
Richard Heathfield <rj*@see.sig.in validwrote:
>arcadio said:

<snip>
>However, I cannot see
where the array types are incomplete here:

/* From the header */
void grphcs_enhnc_ou tsquare(unsigne d char [][]
^^^^
Right here.

Regarding your subject line, "Array has incomplete element type. GCC bug?",
it is generally wisest in the first instance[1] to assume that the bug is
in your code unless you can demonstrate from the Standard that your code
is correct.
While I agree with the sentiment here (including the footnote(s)), the
salient fact here is that OP says it worked (compiled) with the earlier
versions of GCC. Now, assuming he isn't mistaken about that, the fact
is that you can standards-jockey it all you want, it ain't gonna mean
much. Believe me, if TPTB (the ones who are paying the bills) know that
it worked before and it doesn't work now, then, for all practical
purposes, it is a bug (in the new version) - and no amount of
standards-jockeying is going to change that fact.

Or, to put it a little bit more charitably, OP's post can (and should)
be interpreted as: It worked before; it doesn't work now; is there a
workaround?

Jun 27 '08 #6
On Mon, 23 Jun 2008 19:17:17 +0000, Kenny McCormack wrote:
In article <6d************ *************** ***@bt.com>, Richard Heathfield
<rj*@see.sig.in validwrote:
>>arcadio said:

<snip>
>>However, I cannot see
where the array types are incomplete here:

/* From the header */
void grphcs_enhnc_ou tsquare(unsigne d char [][]
^^^^
Right here.
[...]
Or, to put it a little bit more charitably, OP's post can (and should)
be interpreted as: It worked before; it doesn't work now; is there a
workaround?
Sure: declare a pointer to an array of unsigned char of unknown length.

void grphcs_enhnc_ou tsquare(unsigne d char (*)[], ...);
void grphcs_enhnc_ou tsquare(unsigne d char (*outsquare)[], ...) {
...
}

This is what the declaration meant with those older versions of GCC, and
what it would mean in standard C if it weren't specifically disallowed,
anyway.

I'd be surprised to find a sensible use for this type of declaration,
though. It's valid and compiles, but all the other problems of
unsigned char [][] remain, so it would still be good to find a better type
to use.
Jun 27 '08 #7
In article <6c************ *@mid.individua l.net>,
bl****@myrealbo x.com <bl****@myrealb ox.comwrote:
>In article <86************ *************** *******@k37g200 0hsf.googlegrou ps.com>,
arcadio <ar************ ****@gmail.comw rote:
>Thanks, I was quite obfuscated
>Point of English usage: Can one speak of a person being
obfuscated,
Yes. OED has a secondary meaning that makes it clear that it can
apply to a person:

2. Of a person or his or her faculties: confused, bewildered;
amazed, flabbergasted (obs.); (U.S. slang) spec. befuddled with
alcohol, intoxicated (now rare).

There are a few examples given, such as

1860 `G. ELIOT' Mill on Floss I. I. vii. 125 As for uncle Pullet, he
could hardly have been more thoroughly obfuscated if Mr Tulliver had
said that he was going to send Tom to the Lord Chancellor.
--
"[i]t lacks context, and may or may not make sense."
-- Walter J. Phillips
Jun 27 '08 #8
In article <g3**********@c anopus.cc.umani toba.ca>,
Walter Roberson <ro******@ibd.n rc-cnrc.gc.cawrote :
In article <6c************ *@mid.individua l.net>,
bl****@myrealbo x.com <bl****@myrealb ox.comwrote:
In article <86************ *************** *******@k37g200 0hsf.googlegrou ps.com>,
arcadio <ar************ ****@gmail.comw rote:
Thanks, I was quite obfuscated
Point of English usage: Can one speak of a person being
obfuscated,

Yes. OED has a secondary meaning that makes it clear that it can
apply to a person:

2. Of a person or his or her faculties: confused, bewildered;
amazed, flabbergasted (obs.); (U.S. slang) spec. befuddled with
alcohol, intoxicated (now rare).

There are a few examples given, such as

1860 `G. ELIOT' Mill on Floss I. I. vii. 125 As for uncle Pullet, he
could hardly have been more thoroughly obfuscated if Mr Tulliver had
said that he was going to send Tom to the Lord Chancellor.
--
"[i]t lacks context, and may or may not make sense."
-- Walter J. Phillips
Huh! The entry in the online Merriam-Webster

http://www.merriam-webster.com/dictionary/obfuscated

doesn't seem to give this meaning. But okay, I've learned
something!

(If it matters, my post was meant to be possibly-useful information
for someone for whom English might not be a first language. But
maybe he(?) knows it better than I do. Sort of a :-). )

--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
Jun 27 '08 #9
bl****@myrealbo x.com said:
In article <g3**********@c anopus.cc.umani toba.ca>,
Walter Roberson <ro******@ibd.n rc-cnrc.gc.cawrote :
>In article <6c************ *@mid.individua l.net>,
bl****@myrealbo x.com <bl****@myrealb ox.comwrote:
<snip>
>Point of English usage: Can one speak of a person being
obfuscated,

Yes. OED has a secondary meaning that makes it clear that it can
apply to a person:
[...]
>
Huh! The entry in the online Merriam-Webster

http://www.merriam-webster.com/dictionary/obfuscated

doesn't seem to give this meaning. But okay, I've learned
something!
Yes, you've learned that you get the dictionary you pay for. :-)

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3726
by: Paul F. Dietz | last post by:
Is the following legal C? struct foo; struct foo (*p); /* Pointer to array of 10 foo structures */ struct foo { int bar; int baz; }; main() { printf("%d\n", sizeof(*p)); } Paul Dietz dietz@dls.net
6
4193
by: Eric Smith | last post by:
Is a structure containing an incomplete array as its last element (per paragraph 2 of section 6.7.2.1 of ISO/IEC 9899:1999 (E)) itself an incomplete type? That appears to be indicated by paragraph 22 of section 6.2.5. If so, that seems to make it difficult to allocate such structures, because sizeof() is not allowed on incomplete types (paragraph 1 of section 6.5.3.4). For instance, I've routinely done things like this: struct foo {...
22
2203
by: Neo | last post by:
Hi Folks, #include<stdio.h> int main() { int (*p); int arr; int i;
10
6682
by: Adam Warner | last post by:
Hi all, With this structure that records the length of an array of pointers as its first member: struct array { ptrdiff_t length; void *ptr; };
204
12983
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 = {0,1,2,4,9};
21
3088
by: rupesh_533 | last post by:
I am assuming the following things. 1.Pointer to an integer means it points to an integer,On incrementing the pointer,it points to the next integer in memory. 2.Pointer to an array of some size means it points to an array,On incrementing the pointer,it should point to next array of that size. Correct me if i am wrong. We declare a pointer to an integer array of Size N as int (*a);
26
3389
by: Adam Warner | last post by:
Hi all, One cannot return a pointer to an array type in C because C has no first class array types. But one can return a pointer to a struct containing an incomplete array via the illegal but widely supported zero array struct hack: #include <stdlib.h> typedef struct byte_vector_t byte_vector_t;
3
3884
by: Hallvard B Furuseth | last post by:
to find the required alignment of a struct, I've used #include <stddef.h> struct Align_helper { char dummy; struct S align; }; enum { S_alignment = offsetof(struct Align_helper, align) };
3
3993
by: walex | last post by:
Hello guys, I'm trying to install devsec an application for ffpeg for camera,but on,is a c programme,after compilation ,i now type make, then this two error are generated.common.h:67: error: array type has incomplete element type common.h:71: error: array type has incomplete element type make: *** Error 1 make: Leaving directory `/root/devsec-3.0.6/ffmpeg/libavcodec' make: *** Error 2 make: Leaving directory `/root/devsec-3.0.6/ffmpeg'...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.