-
Notifications
You must be signed in to change notification settings - Fork 2
/
bugs.html
655 lines (529 loc) · 23.4 KB
/
bugs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<html>
<head>
<title>GCC Bugs</title>
</head>
<body>
<h1 align="center">GCC Bugs</h1>
<p>The latest version of this document is always available at
<a href="http://gcc.gnu.org/bugs.html">
http://gcc.gnu.org/bugs.html</a>.</p>
<hr>
<h2>Table of Contents</h2>
<ul>
<li><a href="#report">Reporting Bugs</a>
<ul>
<li><a href="#need">What we need</a></li>
<li><a href="#dontwant">What we DON'T want</a></li>
<li><a href="#where">Where to post it</a></li>
<li><a href="#detailed">Detailed bug reporting instructions</a></li>
</ul>
</li>
<li><a href="#manage">Managing Bugs (GNATS and the test-suite)</a></li>
<li><a href="#known">Frequently Reported Bugs in GCC 3.0</a>
<ul>
<li><a href="#general">General</a></li>
<li><a href="#fortran">Fortran</a></li>
<li><a href="#c">C</a></li>
<li><a href="#cplusplus">C++</a>
<ul>
<li><a href="#updating">Common problems updating from G++ 2.95 to
G++ 3.0</a></li>
<li><a href="#nonbugs">Non-bugs</a></li>
<li><a href="#missing">Missing features</a></li>
<li><a href="#parsing">Parse errors for "simple" code</a></li>
<li><a href="#-O3">Optimization at <code>-O3</code> takes a
very long time</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<hr>
<h1><a name="report">Reporting Bugs</a></h1>
<p>Our preferred way of receiving bugs is via the
<a href="gnats.html">GCC GNATS bug reporting system</a>.</p>
<p>Before you report a bug, please check the
<a href="#known">list of well-known bugs</a> and, <strong>if possible
in any way, try a current development snapshot or
<a href="http://www.codesourcery.com/gcc-compile.shtml">CodeSourcery's
Online Test Compilation</a></strong>. If you want to report a bug
with egcs 1.x or versions of GCC before 3.0 we strongly recommend
upgrading to the current release first.</p>
<p>Before reporting that GCC compiles your code incorrectly, please
compile it with <code>gcc -Wall</code> and see whether this shows
anything wrong with your code that could be the cause instead of a bug
in GCC.</p>
<h2>Summarized bug reporting instructions</h2>
<p>After this summary, you'll find detailed bug reporting
instructions, that explain how to obtain some of the information
requested in this summary.</p>
<h3><a name="need">What we need</a></h3>
Please include in your bug report <b>all</b> of the following items:
<ul>
<li>The GCC version (not just 3.xx; run <code>gcc -v</code>)</li>
<li>The system type (the dir name after <code>gcc-lib</code> in the
output of <code>gcc -v</code></li>
<li>The complete command line that triggers the bug</li>
<li>The compiler output (error messages, warnings, etc)</li>
<li>The <b>preprocessed</b> file (<tt>*.i*</tt>) that triggers the
bug, generated by adding <code>-save-temps</code> to the complete
compilation command (see below)</li>
<li>The options given when GCC was configured/built</li>
</ul>
<h3><a name="dontwant">What we DON'T want</a></h3>
<ul>
<li>A source file that <tt>#include</tt>s header files that are left
out of the bug report (see above)</li>
<li>That source file <b>and</b> a collection of header files (don't
waste your time; the preprocessor will collect them for you! :-)
<li>An attached archive (tar, zip, shar, whatever) containing all
(or some :-) of the above, so that we can tell what the bug report
is about without having to unarchive it</li>
<li>A code snippet that won't cause the compiler to produce the
exact output mentioned in the bug report (e.g., a snippet with just
a few lines around the one that <b>apparently</b> triggers the bug,
with some pieces replaced with ellipses or comments for extra
obfuscation :-)</li>
<li>The location (URL) of the package that failed to build (we won't
download it, anyway, since you've already given us what we need to
duplicate the bug, haven't you? :-)</li>
<li>An error that occurs only some of the times a certain file is
compiled, such that retrying a sufficient number of times results in
a successful compilation; this is a symptom of a hardware problem,
not of a compiler bug (sorry)</li>
<li>E-mail messages that complement previous, incomplete bug
reports; post a new, self-contained, full bug report instead, if
possible as a follow-up (or reply) to the original bug report</li>
<li>Assembly files (<tt>*.s</tt>) produced by the compiler, or any
binary files, such as object files, executables or core files</li>
<li>Duplicate bug reports, or reports of bugs already fixed in the
development tree, especially those that have already been reported
as fixed last week :-)</li>
<li>Bugs in the assembler, the linker or the C library. These are
separate projects, with separate mailing lists and different bug
reporting procedures</li>
<li>Bugs in releases or snapshots of GCC not issued by the GNU
Project. Report them to whoever provided you with the release</li>
<li>Questions about the correctness or the expected behavior of
certain constructs that are not GCC extensions. Ask them in forums
dedicated to the discussion of the programming language</li>
</ul>
<h3><a name="where">Where to post it</a></h3>
<p>Please submit your bug report directly to the
<a href="gnats.html">GCC GNATS bug database</a>. If this is not possible,
please mail all information to
<a href="mailto:[email protected]">[email protected]</a>.
<h2><a name="detailed">Detailed bug reporting instructions</a></h2>
<p>In general, all the information we need can be obtained by
collecting the command line below, as well as its output and the
preprocessed file it generates.
<blockquote><code>gcc -v -save-temps <i>all-your-options
source-file</i></code></blockquote>
Typically the preprocessed file (extension <code>.i</code> for C or
<code>.ii</code> for C++) will be large, so please compress the
resulting file with one of the popular compression programs such as
bzip2, gzip, zip or compress (in
decreasing order of preference). Use maximum compression
(<code>-9</code>) if available. <b>Please</b> include the compressed
preprocessor output in your bug report, even if the source code is
freely available elsewhere; it makes the job of our volunteer testers
much easier.</p>
<p>The <b>only</b> excuses to not send us the preprocessed sources are
(i) if you've found a bug in the preprocessor, or (ii) if you've
reduced the testcase to a small file that doesn't include <b>any</b>
other file. If you can't post the preprocessed sources because
they're proprietary code, then try to create a small file that
triggers the same problem.</p>
<p>Since we're supposed to be able to re-create the assembly output
(extension <code>.s</code>), you usually should <b>not</b> include
it in the bug report, although you may want to post parts of it to
point out assembly code you consider to be wrong.</p>
<p>Whether to use MIME attachments or <code>uuencode</code> is up to
you. In any case, make sure the compiler command line, version and
error output are in plain text, so that we don't have to decode the
bug report in order to tell who should take care of it. A meaningful
subject indicating language and platform also helps.</p>
<p>Please avoid posting an archive (.tar, .shar or .zip); we generally
need just a single file to reproduce the bug (the .i/.ii preprocessed
file), and, by storing it in an archive, you're just making our
volunteers' jobs harder. Only when your bug report requires multiple
source files to be reproduced should you use an archive. In any case,
make sure the compiler version, error message, etc, are included in
the body of your bug report as plain text, even if needlessly
duplicated as part of an archive.</p>
<p>The gcc lists have message size limits (200 kbytes) and bug reports
over those limits will currently be bounced. If your bug is larger
than that, please post it using the <a href="gnats.html">GCC GNATS bug
database</a>.</p>
<p>If you fail to supply enough information for a bug report to be
reproduced, someone will probably ask you to post additional
information (or just ignore your bug report, if they're in a bad day,
so try to get it right on the first posting :-). In this case, please
post the additional information to the bug reporting mailing list, not
just to the person who requested it, unless explicitly told so. If
possible, please include in this follow-up all the information you had
supplied in the incomplete bug report (including the preprocessor
output), so that the new bug report is self-contained.</p>
<h1><a name="manage">Managing Bugs (GNATS and the test-suite)</a></h1>
<p>This section contains information mostly intended for GCC
contributors.</p>
<p>If you find a bug, but you are not fixing it (yet):</p>
<ol>
<li>Create a (minimal) test-case.</li>
<li>Add the test-case to our test-suite, marking it as XFAIL.</li>
<li>Add a bug report referencing the test-case to GNATS.</li>
</ol>
<p>If you fix a bug for which there is already a GNATS entry:</p>
<ol>
<li>Remove the XFAIL on the test-case.</li>
<li>Close the bug report in GNATS.</li>
</ol>
<p>If you find a bug, and you are fixing it right then:</p>
<ol>
<li>Create a (minimal) test-case.</li>
<li>Add the test-case to our test-suite, marking it as PASS.</li>
<li>Check in your fixes.</li>
</ol>
<hr>
<h1><a name="known">Frequently Reported Bugs in GCC 3.0</a></h1>
<h2><a name="general">General</a></h2>
<p>The following bugs are very frequently reported.</p>
<ul>
<li>GCC 2.95.2 does not build on GNU/Linux systems using glibc 2.2,
such as Red Hat 7.0. A <a href="install/glibc-2.2.patch">patch</a> is
available. This is fixed in GCC 2.95.3 and GCC 3.0.</li>
<li>GCC 2.95.2 crashes when compiling <code>mbx.c</code> from the PINE
4.30 or IMAP2000 distribution on Sparc systems running Solaris.</li>
</ul>
<hr>
<h2><a name="fortran">Fortran</a></h2>
<p> Fortran bugs are documented in the G77 manual rather than
explicitly listed here. Please see
<a href="onlinedocs/g77_bugs.html">"Known Causes of Trouble with GNU
Fortran"</a> in the <a href="onlinedocs/g77_toc.html">G77 manual.</a>
<hr>
<h2><a name="c">C</a></h2>
<p>The following are not bugs in the C compiler, but are reported
often enough to warrant a mention here.</p>
<dl>
<dt><em>Cannot initialize a static variable with
<code>stdin</code>.</em></dt>
<dd><p>This has nothing to do with GCC, but people ask us about it a
lot. Code like this:
<blockquote><code>
#include <stdio.h>
FILE *yyin = stdin;
</code></blockquote>
will not compile with GNU libc (GNU/Linux libc6), because
<code>stdin</code> is not a constant. This was done deliberately, in
order for there to be no limit on the number of open <code>FILE</code>
objects. It is surprising for people used to traditional Unix C
libraries, but it is permitted by the C standard.</p>
<p>This construct commonly occurs in code generated by old versions of
lex or yacc. We suggest you try regenerating the parser with a
current version of flex or bison, respectively. In your own code, the
appropriate fix is to move the initialization to the beginning of
main.</p>
<p>There is a common misconception that the GCC developers are
responsible for GNU libc. These are in fact two entirely separate
projects. The appropriate place to ask questions relating to GNU libc
is <a href="mailto:[email protected]">
[email protected]</a>.
</p></dd>
<dt><em>Cannot use preprocessor directive in macro arguments.</em></dt>
<dd><p>Let me guess... you wrote code that looks something like this:
<blockquote><code>
memcpy(dest, src,
#ifdef PLATFORM1
12
#else
24
#endif
);
</code></blockquote>
and you got a whole pile of error messages:
<blockquote><code>
test.c:11: warning: preprocessing directive not recognized within
macro arg<br>
test.c:11: warning: preprocessing directive not recognized within
macro arg<br>
test.c:11: warning: preprocessing directive not recognized within
macro arg<br>
test.c: In function `foo':<br>
test.c:6: undefined or invalid # directive<br>
test.c:8: undefined or invalid # directive<br>
test.c:9: parse error before `24'<br>
test.c:10: undefined or invalid # directive<br>
test.c:11: parse error before `#'<br>
</code></blockquote>
The problem, simply put, is that GCC's preprocessor does not allow you
to put <code>#ifdef</code> (or any other directive) inside the arguments of
a macro. Your C library's <code><string.h></code> happens to
define <code>memcpy</code> as a macro - this is perfectly legitimate.
The code therefore will not compile.</p>
<p>We have two good reasons for not allowing directives inside
macro arguments. First, it is not portable. It is "undefined
behavior" according to the C standard; that means different
compilers will do different things with it. Some will give you
errors. Some will dump core. Some will silently mangle your code -
you could get the equivalent of</p>
<pre>
memcpy(dest, src, 1224);
</pre>
<p>from the above example. A very few might do what you expected it
to. We therefore feel it is most useful for GCC to reject this
construct immediately so that it is found and fixed.</p>
<p>Second, it is extraordinarily difficult to implement the
preprocessor such that it does what you would expect for every
possible directive found inside a macro argument. The best example is
perhaps
<blockquote><code>
#define foo(arg) ... arg ...<br>
foo(blah<br>
#undef foo<br>
blah)<br>
</code></blockquote>
which is <em>impossible</em> to implement in portable C without
leaking memory. Allowing only a subset of directives would be
confusing.</p>
<p>It is always possible to rewrite code which uses conditionals
inside macros so that it doesn't. You could write the above
example
<blockquote><code>
#ifdef PLATFORM1<br>
memcpy(dest, src, 12);<br>
#else<br>
memcpy(dest, src, 24);<br>
#endif<br>
</code></blockquote>
This is a bit more typing, but I personally think it's better style
in addition to being more portable.</p>
<p>In recent versions of glibc, <code>printf</code> is among the
functions which are implemented as macros.</p></dd>
</dl>
<hr>
<h2><a name="cplusplus">C++</a></h2>
<p>This is the list of bugs (and non-bugs) in g++ (aka GNU C++) that
are reported very often, but not yet fixed. While it is certainly
better to fix bugs instead of documenting them, this document might
save people the effort of writing a bug report when the bug is already
well-known. <a href="#report">How to report bugs</a> tells you how to
report a bug.
<p>There are many reasons why reported bugs don't get fixed. It might
be difficult to fix, or fixing it might break compatibility. Often,
reports get a low priority when there is a simple work-around. In
particular, bugs caused by invalid C++ code have a simple work-around,
<em>fix the code</em>. Now that there is an agreed ISO/ANSI standard
for C++, the compiler has a definitive document to adhere to. Earlier
versions might have accepted source code that is <em>no longer</em>
C++. This means that code which might have `worked' in a previous
version, is now rejected. You should update your code to be C++.
<p>You should try to use the latest stable release of the GNU C++
compiler. This is currently 3.0. Many commonly reported bugs in
earlier releases are fixed in that version.</p>
<h3><a name="updating">Common problems updating from G++ 2.95 to G++
3.0</a></h3>
<p>G++ 3.0 conforms much closer to the ISO C++ standard (available at
<a href="http://www.ncits.org/cplusplus.htm">http://www.ncits.org/cplusplus.htm</a>).</p>
<p>We have also implemented some of the core and library defect reports
(available at
<a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html">http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html</a>
&
<a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html">
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html</a>
respectively).</p>
<ul>
<li>The ABI has changed. This means that both class layout and name
mangling is different. You <em>must</em> recompile all c++ libraries (if
you don't you will get link errors).
<li>The standard library is much more conformant, and uses the
<code>std::</code> namespace.
<li><code>std::</code> is now a real namespace, not an alias for
<code>::</code>.
<li>The standard header files for the c library don't end with
<code>.h</code>, but begin with <code>c</code> (i.e.
<code><cstdlib></code> rather than <code><stdlib.h></code>).
The <code>.h</code> names are still available, but are deprecated.
<li><code><strstream></code> is deprecated, use
<code><sstream></code> instead. (The 3.0 BUGS file says
<code><stringstream></code>, that was an error,
<code>stringstream</code> is the class defined in
<code><sstream></code>.)
<li><code>streambuf::seekoff</code> &
<code>streambuf::seekpos</code> are private, instead use
<code>streambuf::pubseekoff</code> &
<code>streambuf::pubseekpos</code> respectively.
<li>If <code>std::operator << (std::ostream &, long long)</code>
doesn't exist, you need to recompile libstdc++ with
<code>--enable-long-long</code>.
</ul>
This means you may get lots of errors about things like
<code>strcmp</code> not being found. You've most likely forgotton to
tell the compiler to look in the <code>std::</code> namespace. There are
several ways to do this,
<ul>
<li>Say, <code>std::strcmp</code> at the call. This is the most explicit
way of saying what you mean.
<li>Say, <code>using std::strcmp;</code> somewhere before the call. You
will need to do this for each function or type you wish to use from the
standard library.
<li>Say, <code>using namespace std;</code> somewhere before the call.
This is the quick-but-dirty fix. This brings the <em>whole</em> of the
<code>std::</code> namespace into scope. <em>Never</em> do this in a
header file, as you will be forcing users of your header file to do the
same.
</ul>
<h3><a name="nonbugs">Non-bugs</a></h3>
<p>Here are some features that have been reported as bugs, but are
not.</p>
<dl>
<dt><em>Nested classes can access private types of the containing
class.</em></dt>
<dd><p>G++ now implements type access control on member types. Defect
report 45 clarifies that nested classes are members of the class they
are nested in, and so are granted access to private members of that
class.</p></dd>
<dt><em>Classes in exception specifiers must be complete
types.</em></dt>
<dd><p>[15.4]/1 tells you that you cannot have an incomplete type, or
pointer to incomplete (other than <code><i>cv</i> void *</code>) in
an exception specification.</p></dd>
<dt><em>G++ emits two copies of constructors and destructors.</em></dt>
<dd><p>In general there are <em>three</em> types of constructors (and
destructors).
<ol>
<li>The complete object constructor/destructor.
<li>The base object constructor/destructor.
<li>The allocating destructor/deallocating destructor.
</ol>
The first two are different, when virtual base classes are involved.
In some cases we can do better, and this is logged in GNATS.</p>
<dt><em>Exceptions don't work in multithreaded applications.</em></dt>
<dd><p>You need to rebuild g++ and libstdc++ with
<code>--enable-threads</code>. Remember, c++ exceptions are not like
hardware interrupts. You cannot throw an exception in one thread and
catch it in another. You cannot throw an exception from a signal
handler, and catch it in the main thread.</p></dd>
<dt><em>Global destructors are not run in the correct order.</em></dt>
<dd><p>Global destructors should be run in the reverse order of their
constructors <em>completing</em>. In most cases this is the same as
the reverse order of constructors <em>starting</em>, but sometimes it
is different, and that is important. You need to compile and link your
programs with <code>--use-cxa-atexit</code>. We have not turned this
switch on by default, as it requires a <code>cxa</code> aware runtime
library (<code>libc</code>, <code>glibc</code>, or
equivalent).</p></dd>
<dt><em>Problems with floating point computations.</em></dt>
<dd><p>In a number of cases, GCC appears to perform floating point
computations incorrectly. For example, the program
<blockquote><code>
#include <iostream><br>
<br>
int main() {<br>
<br>
double min = 0.0;<br>
double max = 0.5;<br>
double width = 0.01;<br>
std::cout << (int)(((max - min) / width) - 1) <<
std::endl;<br>
<br>
}<br>
</code></blockquote>
might print 50 on some systems and optimization levels, and 51 on
others.</p>
<p>The is the result of <em>rounding</em>: The computer cannot
represent all real numbers exactly, so it has to use
approximations. When computing with approximation, the computer needs
to round to the nearest representable number.</p>
<p>This is not a bug in the compiler, but an inherent limitation of
the float and double types. Please study
<a href="http://www.validgh.com/goldberg/paper.ps">this paper</a>
for more information.</p></dd>
</dl>
<h3><a name="missing">Missing features</a></h3>
<p>We know some things are missing from G++.</p>
<dl>
<dt><em>The <code>export</code> keyword is not implemented.</em></dt>
<dd><p>Most C++ compilers (G++ included) do not yet implement
<code>export</code>, which is necessary for separate compilation of
template declarations and definitions. Without <code>export</code>, a
template definition must be in scope to be used. The obvious
workaround is simply to place all definitions in the header
itself. Alternatively, the compilation unit containing template
definitions may be included from the header.</p></dd>
<dt><em>Two stage lookup in templates is not implemented.</em></dt>
<dd><p>[14.6] specifies how names are looked up inside a template. G++
does not do this correctly, but for most templates this will not be
noticeable.</p></dd>
</dl>
<h3><a name="parsing">Parse errors for "simple" code</a></h3>
Up to and including GCC 3.0, the compiler will give "parse error" for
seemingly simple code, such as
<pre>
struct A{
A();
A(int);
void func();
};
struct B{
B(A);
B(A,A);
void func();
};
void foo(){
B b(A(),A(1)); //Variable b, initialized with two temporaries
B(A(2)).func(); //B temporary, initialized with A temporary
}
</pre>
The problem is that GCC starts to parse the declaration of
<CODE>b</CODE> as a function <CODE>b</CODE> returning <CODE>B</CODE>,
taking a function returning <CODE>A</CODE> as an argument. When it
sees the 1, it is too late. The work-around in these cases is to add
additional parentheses around the expressions that are mistaken as
declarations:
<pre>
(B(A(2))).func();
</pre>
Sometimes, even that is not enough; to show the compiler that this
should be really an expression, a comma operator with a dummy argument
can be used:
<pre>
B b((0,A()),A(1));
</pre>
<p>
Another example is the parse error for the <CODE>return</CODE>
statement in
<pre>
struct A{};
struct B{
A a;
A f1(bool);
};
A B::f1(bool b)
{
if (b)
return (A());
return a;
}
</pre>
<p>The problem is that the compiler interprets <CODE>A()</CODE> as a
function (taking no arguments, returning <CODE>A</CODE>), and
<CODE>(A()</CODE>) as a cast - with a missing expression, hence the
parse error. The work-around is to omit the parentheses:
<pre>
if (b)
return A();
</pre>
<p>This problem occurs in a number of variants; in <CODE>throw</CODE>
statements, people also frequently put the object in parentheses. The
exact error also somewhat varies with the compiler version. The
work-arounds proposed do not change the semantics of the program at
all; they make them perhaps less readable.
<h3><a name="-O3">Optimization at <code>-O3</code> takes a
very long time</a></h3>
<p>At <code>-O3</code>, all functions are candidates for inlining. The
heuristic used has some deficiencies which show up when allowed such
freedom. This is g++ specific, as it has an earlier inliner than
gcc.</p>
</body>
</html>