小便尿色黄是什么问题| 哥德巴赫猜想是什么| acth是什么激素| 1941年是什么年| 精液的主要成分是什么| 三毛为什么自杀| 爱到什么时候| 波菜不能和什么一起吃| 孕妇鼻炎犯了可以用什么药治疗| 小肚子胀是什么原因女性| 葛粉吃了有什么好处| 孩子发烧手脚冰凉是什么原因| 股票填权是什么意思| 菊花泡茶有什么功效| 中秋吃什么| 九个口是什么字| 11月2日什么星座| 金碧辉煌是什么生肖| 安宫牛黄丸主治什么病| 亚急性甲状腺炎吃什么药| 1999年属兔的是什么命| 七月份能种什么菜| 小便发黄是什么原因| 决心是什么意思| 舌头长泡吃什么药| 指甲发白是什么原因| 马齿苋什么人不能吃| 36计的第一计是什么| 喝玉米水有什么好处| 宫腔粘连是什么意思| 大便干燥一粒一粒的是什么原因| 清明节吃什么好| 阿姨是什么意思| 吃什么可以降低血糖| 纯阴八字为什么要保密| 黑茶金花是什么菌| 磨牙齿是什么原因| vod是什么意思| 莲藕什么时候种植最佳| bayer是什么药| 什么是月经不调| 紫癜是什么病| 粉刺用什么药膏最有效| 性激素检查是查什么| 喜爱的反义词是什么| 肺燥吃什么中成药| 唐僧真名叫什么| 胃不舒服吃什么| 什么人容易得天疱疮| 腰椎间盘突出适合什么运动| 不来月经是什么原因| 肛瘘是什么情况| 紫药水是什么| 浑身麻是什么原因| 怀孕10天有什么症状| 番号是什么意思| 扁桃体发炎不能吃什么东西| 什么是汛期| 美国有什么特产| 咽拭子是检查什么的| 什么蔬菜是温性的| 阿赖耶识是什么意思| 男性支原体感染什么症状| 1965年什么时候退休| 胚芽米是什么米| 3.22什么星座| nt和无创有什么区别| 心悸症状是什么感觉| 吃什么长得高| 万金油什么意思| 腹腔淋巴结肿大是什么原因| 2011年是什么生肖| 什么是gsp| 什么玉最好有灵性养人| 6月五行属什么| 意味深长的意思是什么| ochirly是什么牌子| 糖尿病什么水果不能吃| 九五至尊什么意思| 经常胃胀气是什么原因引起的| 阿司匹林肠溶片什么时间吃最好| 断桥铝是什么意思| 酱是什么意思| ac代表什么意思| 肋间神经痛吃什么药| 早上三点是什么时辰| 定投是什么意思| 梦见别人开车翻车是什么预兆| 下雨了是什么意思| 梦到生孩子是什么意思| 尿酸为什么会高| 脑梗吃什么药效果最好| 炎黄子孙是什么生肖| 胃酸恶心想吐什么原因| 为什么牛肝便宜没人吃| 茧是什么意思| 5.5号是什么星座| 阴虚吃什么食物| 感冒可以吃什么水果| 阿凡提是什么意思| 什么样的白带是怀孕了| 为什么叫211大学| 梦见自己在洗澡是什么意思| 止鼾什么方法最有效| 官方旗舰店和旗舰店有什么区别| 吃什么有助于骨头恢复| 残联是什么性质的单位| 黄芪什么味道| 巧克力囊肿有什么症状表现| 近字五行属什么| 今年78岁属什么生肖| 粽子是什么意思| sandisk是什么牌子| 疝囊是什么| pass是什么意思| 肉蔻炖肉起什么作用| 三句半是什么意思| 5月24日是什么星座| phoebe是什么意思| 风包念什么| queen是什么意思| q热是什么病| 宫颈囊肿是什么症状| 羊水栓塞是什么原因引起的| 梦见摘枣是什么意思| 咖啡喝多了有什么危害| 覆盆子是什么| 内裤上有黄色分泌物是什么原因| 急性肠胃炎可以吃什么水果| 抑郁症什么症状| 兄长是什么意思| 欺山莫欺水是什么意思| 车震是什么| 天机不可泄露是什么意思| 女人肝胆湿热吃什么药| 胸痛是什么原因导致的| bonnie是什么意思| 猫鼻支什么症状| 孙悟空原名叫什么| 为什么来大姨妈会拉肚子| 吃二甲双胍为什么会瘦| tnt是什么| 俄罗斯和白俄罗斯有什么区别| ecology是什么意思| 吃什么可以长头发| 免费查五行缺什么| 经常长溃疡是什么原因引起的| 睡觉爱流口水是什么原因| 八月三十日是什么星座| 父母都没有狐臭为什么孩子会有呢| 极差是什么| 什么问题| 卵巢早衰吃什么药调理最好| 阴虚火旺吃什么中成药| 一什么阳光| 癸未日五行属什么| 如日中天的意思是什么| 什么是舒张压和收缩压| 眼睑是什么意思| 数学专业学什么| 眼皮突然肿了是什么原因| 519是什么星座| 胀气吃什么食物好| 鱼油不适合什么人吃| 祥五行属什么| 鼻腔有臭味是什么原因| 芙蓉花长什么样| 肠瘘是什么意思| 三月初九是什么星座| 嘱托是什么意思| 纯阴八字为什么要保密| 胃胀呕吐是什么原因| 什么是软文| 蜗牛为什么怕盐| 鱼饼是什么做的| rt是什么意思| 高铁动力来源是什么| 乳腺囊肿吃什么药| 甲亢可以吃什么| 属狗的幸运色是什么颜色| 炖牛肉不放什么调料| 吃什么会变丑脑筋急转弯| 狗跟什么生肖最配| tg医学上是什么意思| 10月30是什么星座| 人绒毛膜促性腺激素是什么意思| 百岁山和景田什么关系| 清朝皇帝姓什么| 月经期不能吃什么| 小腹右边疼是什么原因| 蔗去掉草字头读什么| 头孢是什么药| 1909年属什么生肖| 坎是什么意思| 灭吐灵又叫什么名字| ff是什么牌子| 蚕屎做枕头有什么好处| 7.14是什么日子| 11月份什么星座| 乳房结节是什么原因引起的| 傲慢什么意思| 改进什么| 唐顿庄园讲的是什么| 饱和什么意思| 腿毛长得快是什么原因| 胎盘低置状态是什么意思| 陈惠敏和陈慧琳什么关系| 胃肠炎可以吃什么水果| 九一年属什么生肖| 飞机杯是什么东西| 四象是什么| 海纳百川是什么意思| sod是什么意思| 派出所什么时候上班| 胎儿脉络丛囊肿是什么原因引起的| 什么大叫| 高压偏低有什么危害| 苏轼是什么居士| 每逢佳节倍思亲的上一句是什么| 阿莫西林有什么副作用| 肺结核传染途径是什么| 与其让你在我怀中枯萎是什么歌| 名存实亡是什么意思| 隐翅虫咬了用什么药膏| 吃避孕药不能吃什么东西| 乐五行属什么| 4五行属什么| 摩根石是什么| 埋汰是什么意思| 脑部ct挂什么科| 一什么老虎| 梦到和死人说话是什么意思| 张仲景的著作是什么| 啾是什么意思| 家政是干什么的| 凛冽是什么意思| 舍曲林是什么药| 孕妇刚生完孩子吃什么好| 耳鸣用什么药治疗效果最好| 咿呀咿呀哟是什么歌| 香蕉补什么| 拔罐的原理是什么| 鬼压床是什么原因| 两边太阳胀痛什么原因引起的| 光膀子什么意思| 为什么头出汗特别多| 嵌顿是什么意思| 小猫不能吃什么食物| 看脖子挂什么科| normal什么意思| 术后恢复吃什么好| 什么时候闰三月| 肺部有结节要注意什么| 肝火旺盛是什么原因引起的| 不举是什么原因造成的| 尿路感染吃什么药效果最好| ks是什么意思| 检出限是什么意思| 打闭经针有什么副作用| 肝上火有什么症状| 嘴角长痘痘是什么原因| 冬是什么结构| 什么的孙悟空| 孤单的我还是没有改变是什么歌| 百度

Table of Contents


Reporting Bugs

百度 找到个人与世界之间建立联系的方式,是探寻任何社会问题的本质。

A good bug report, which is complete and self-contained, enables us to fix the bug.

Before you report a bug, please check the list of well-known bugs and, if possible, try a current release or development snapshot.

Before reporting that GCC compiles your code incorrectly, compile it with gcc -Wall -Wextra and see whether this shows anything wrong with your code. Similarly, if compiling with -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations makes a difference, or if compiling with -fsanitize=address,undefined produces any run-time errors, then your code is probably not correct.

We also ask that for C++ code, users test their programs with -D_GLIBCXX_ASSERTIONS. If you're able to rebuild the entire program (including any libraries it uses, because it changes ABI), please do try libstdc++'s debug mode (-D_GLIBCXX_DEBUG) which enables more thorough checking in parts of the C++ standard library. If either of these fail, this is a strong indicator of an error in your code.

Summarized bug reporting instructions

After this summary, you'll find detailed instructions that explain how to obtain some of the information requested in this summary.

What we need

Please include all of the following items, the first three of which can be obtained from the output of gcc -v:

What we do not want

Where to post it

Please submit your bug report directly to the GCC bug tracker.

The GCC bug tracker requires you to create an account with a valid e-mail address. This is not merely to be annoying. It's because in the past spammers have filed fake bug reports, and fake attachments to real bug reports, to distribute malware and to add links to their spam web sites. Requiring a valid e-mail address is a partial deterrent to this. We apologize for the inconvenience.

Detailed bug reporting instructions

Please refer to the next section when reporting bugs in GNAT, the Ada compiler, or to the one after that when reporting bugs that appear when using a precompiled header.

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.

gcc -v -save-temps all-your-options source-file

The preprocessed source is the basic requirement to fix a bug. However, providing a minimal testcase increases the chances of getting your bug fixed. The only excuses to not send us the preprocessed sources are (i) if you've found a bug in the preprocessor, (ii) if you've reduced the testcase to a small file that doesn't include any other file or (iii) if the bug appears only when using precompiled headers. 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.

Since we're supposed to be able to re-create the assembly output (extension .s), you usually should not 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.

Please avoid posting an archive (.tar, .shar or .zip); we generally need just a single file to reproduce the bug (the .i/.ii/.f 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. This is, for example, the case if you are using INCLUDE directives in Fortran code, which are not processed by the preprocessor, but the compiler. In that case, we need the main file and all INCLUDEd files. 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.

Detailed bug reporting instructions for GNAT

See the previous section for bug reporting instructions for GCC language implementations other than Ada.

Bug reports have to contain at least the following information in order to be useful:

If your code depends on additional source files (usually package specifications), submit the source code for these compilation units in a single file that is acceptable input to gnatchop, i.e. contains no non-Ada text. If the compilation terminated normally, you can usually obtain a list of dependencies using the "gnatls -d main_unit" command, where main_unit is the file name of the main compilation unit (which is also passed to gcc).

If you report a bug which causes the compiler to print a bug box, include that bug box in your report, and do not forget to send all the source files listed after the bug box along with your report.

If you use gnatprep, be sure to send in preprocessed sources (unless you have to report a bug in gnatprep).

When you have checked that your report meets these criteria, please submit it according to our generic instructions. (If you use a mailing list for reporting, please include an "[Ada]" tag in the subject.)

Detailed bug reporting instructions when using a precompiled header

If you're encountering a bug when using a precompiled header, the first thing to do is to delete the precompiled header, and try running the same GCC command again. If the bug happens again, the bug doesn't really involve precompiled headers, please report it without using them by following the instructions above.

If you've found a bug while building a precompiled header (for instance, the compiler crashes), follow the usual instructions above.

If you've found a real precompiled header bug, what we'll need to reproduce it is the sources to build the precompiled header (as a single .i file), the source file that uses the precompiled header, any other headers that source file includes, and the command lines that you used to build the precompiled header and to use it.

Please don't send us the actual precompiled header. It is likely to be very large and we can't use it to reproduce the problem.


Frequently Reported Bugs

There are many reasons why a reported bug doesn'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 code have a simple work-around: fix the code.


Non-bugs

The following are not actually bugs, but are reported often enough to warrant a mention here.

It is not always a bug in the compiler, if code which "worked" in a previous version, is now rejected. Earlier versions of GCC sometimes were less picky about standard conformance and accepted invalid source code. In addition, programming languages themselves change, rendering code invalid that used to be conforming (this holds especially for C++). In either case, you should update your code to match recent language standards.


General

Problems with floating point numbers - the most often reported non-bug.

In a number of cases, GCC appears to perform floating point computations incorrectly. For example, the C++ program

#include <iostream>

int main()
{
  double a = 0.5;
  double b = 0.01;
  std::cout << (int)(a / b) << std::endl;
  return 0;
}

might print 50 on some systems and optimization levels, and 49 on others.

This is the result of rounding: 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.

This is an inherent limitation of floating point types, not a bug. See Goldberg's What Every Computer Scientist Should Know about Floating-Point Arithmetic for more information.


C

Increment/decrement operator (++/--) not working as expected - a problem with many variations.

The following expressions have unpredictable results:

x[i]=++i
foo(i,++i)
i*(++i)                 /* special case with foo=="operator*" */
std::cout << i << ++i   /* foo(foo(std::cout,i),++i)          */

since the i without increment can be evaluated before or after ++i.

The C and C++ standards have the notion of "sequence points". Everything that happens between two sequence points happens in an unspecified order, but it has to happen after the first and before the second sequence point. The end of a statement and a function call are examples for sequence points, whereas assignments and the comma between function arguments are not.

Modifying a value twice between two sequence points as shown in the following examples is even worse:

i=++i
foo(++i,++i)
(++i)*(++i)               /* special case with foo=="operator*" */
std::cout << ++i << ++i   /* foo(foo(std::cout,++i),++i)        */

This leads to undefined behavior (i.e. the compiler can do anything).

Casting does not work as expected when optimization is turned on.

This is often caused by a violation of aliasing rules, which are part of the ISO C standard. These rules say that a program is invalid if you try to access a variable through a pointer of an incompatible type. This is happening in the following example where a short is accessed through a pointer to integer (the code assumes 16-bit shorts and 32-bit ints):

#include <stdio.h>

int main()
{
  short a[2];

  a[0]=0x1111;
  a[1]=0x1111;

  *(int *)a = 0x22222222; /* violation of aliasing rules */

  printf("%x %x\n", a[0], a[1]);
  return 0;
}

The aliasing rules were designed to allow compilers more aggressive optimization. Basically, a compiler can assume that all changes to variables happen through pointers or references to variables of a type compatible to the accessed variable. Dereferencing a pointer that violates the aliasing rules results in undefined behavior.

In the case above, the compiler may assume that no access through an integer pointer can change the array a, consisting of shorts. Thus, printf may be called with the original values of a[0] and a[1]. What really happens is up to the compiler and may change with architecture and optimization level.

Recent versions of GCC turn on the option -fstrict-aliasing (which allows alias-based optimizations) by default with -O2. And some architectures then really print "1111 1111" as result. Without optimization the executable will generate the "expected" output "2222 2222".

To disable optimizations based on alias-analysis for faulty legacy code, the option -fno-strict-aliasing can be used as a work-around.

The option -Wstrict-aliasing (which is included in -Wall) warns about some - but not all - cases of violation of aliasing rules when -fstrict-aliasing is active.

To fix the code above, you can use a union instead of a cast (note that this is a GCC extension which might not work with other compilers):

#include <stdio.h>

int main()
{
  union
  {
    short a[2];
    int i;
  } u;

  u.a[0]=0x1111;
  u.a[1]=0x1111;

  u.i = 0x22222222;

  printf("%x %x\n", u.a[0], u.a[1]);
  return 0;
}

Now the result will always be "2222 2222".

For some more insight into the subject, please have a look at this article.

Loops do not terminate

This is often caused by out-of-bound array accesses or by signed integer overflow which both result in undefined behavior according to the ISO C standard. For example

int
SATD (int* diff, int use_hadamard)
{
  int k, satd = 0, m[16], dd, d[16];
  ...
    for (dd=d[k=0]; k<16; dd=d[++k])
      satd += (dd < 0 ? -dd : dd);

accesses d[16] before the loop is exited with the k<16 check. This causes the compiler to optimize away the exit test because the new value of k must be in the range [0, 15] according to ISO C.

GCC starting with version 4.8 has a new option -fno-aggressive-loop-optimizations that may help here. If it does, then this is a clear sign that your code is not conforming to ISO C and it is not a GCC bug.

Cannot use preprocessor directive in macro arguments.

Let me guess... you used an older version of GCC to compile code that looks something like this:

  memcpy(dest, src,
#ifdef PLATFORM1
	 12
#else
	 24
#endif
	);

and you got a whole pile of error messages:

test.c:11: warning: preprocessing directive not recognized within macro arg
test.c:11: warning: preprocessing directive not recognized within macro arg
test.c:11: warning: preprocessing directive not recognized within macro arg
test.c: In function `foo':
test.c:6: undefined or invalid # directive
test.c:8: undefined or invalid # directive
test.c:9: parse error before `24'
test.c:10: undefined or invalid # directive

This is because your C library's <string.h> happens to define memcpy as a macro - which is perfectly legitimate. In recent versions of glibc, for example, printf is among those functions which are implemented as macros.

Versions of GCC prior to 3.3 did not allow you to put #ifdef (or any other preprocessor directive) inside the arguments of a macro. The code therefore would not compile.

As of GCC 3.3 this kind of construct is always accepted and the preprocessor will probably do what you expect, but see the manual for detailed semantics.

However, this kind of code is not portable. It is "undefined behavior" according to the C standard; that means different compilers may do different things with it. It is always possible to rewrite code which uses conditionals inside macros so that it doesn't. You could write the above example

#ifdef PLATFORM1
   memcpy(dest, src, 12);
#else
   memcpy(dest, src, 24);
#endif

This is a bit more typing, but I personally think it's better style in addition to being more portable.

Cannot initialize a static variable with stdin.

This has nothing to do with GCC, but people ask us about it a lot. Code like this:

#include <stdio.h>

FILE *yyin = stdin;

will not compile with GNU libc, because stdin is not a constant. This was done deliberately, to make it easier to maintain binary compatibility when the type FILE needs to be changed. It is surprising for people used to traditional Unix C libraries, but it is permitted by the C standard.

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.

There is a common misconception that the GCC developers are responsible for GNU libc. These are in fact two entirely separate projects; please check the GNU libc web pages for details.


C++

Functions can be called without qualifying them with their namespace.

Argument Dependent Lookup (ADL) means that functions can be found in namespaces associated with their arguments. This means that move(arg) can call std::move if arg is a type defined in namespace std, such as std::string or std::vector. If std::move is not the function you intended to call, use a qualified name such as ::move(arg) or foo::move(arg).

Nested classes can access private members and types of the containing class.

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.

G++ emits two copies of constructors and destructors.

In general there are three types of constructors (and destructors).

  1. The complete object constructor/destructor.
  2. The base object constructor/destructor.
  3. The allocating constructor/deallocating destructor.

The first two are different, when virtual base classes are involved.

Global destructors are not run in the correct order.

Global destructors should be run in the reverse order of their constructors completing. In most cases this is the same as the reverse order of constructors starting, but sometimes it is different, and that is important. You need to compile and link your programs with --use-cxa-atexit. We have not turned this switch on by default, as it requires a cxa aware runtime library (libc, glibc, or equivalent).

Classes in exception specifiers must be complete types.

[15.4]/1 tells you that you cannot have an incomplete type, or pointer to incomplete (other than cv void *) in an exception specification.

Exceptions don't work in multithreaded applications.

You need to rebuild g++ and libstdc++ with --enable-threads. 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.

Templates, scoping, and digraphs.

If you have a class in the global namespace, say named X, and want to give it as a template argument to some other class, say std::vector, then std::vector<::X> fails with a parser error in C++98/C++03 mode.

The reason is that the C++98 standard mandates that the sequence <: is treated as if it were the token [. (There are several such combinations of characters - they are called digraphs.) Depending on the version, the compiler then reports a parse error before the character : (the colon before X) or a missing closing bracket ].

The simplest way to avoid this is to write std::vector< ::X>, i.e. place a space between the opening angle bracket and the scope operator, or compile using C++11 or later. Defect report 1104 changed the parser rules so that <:: works as expected.

Common problems when upgrading the compiler

GCC maintains a 'Porting to' resource for new versions: GCC 15 | GCC 14 | GCC 13 | GCC 12 | GCC 11 | GCC 10 | GCC 9 | GCC 8 | GCC 7 | GCC 6 | GCC 5 | GCC 4.9 | GCC 4.8 | GCC 4.7 | GCC 4.6 | GCC 4.4 | GCC 4.3.

ABI changes

The C++ application binary interface (ABI) consists of two components: the first defines how the elements of classes are laid out, how functions are called, how function names are mangled, etc; the second part deals with the internals of the objects in libstdc++. For C++ standards marked as experimental, stable ABI is not guaranteed: for these, if you change your compiler to a different major release you must recompile any libraries that were built using a C++ -std= flag that was still experimental. If you fail to do so, you risk getting linker errors or malfunctioning programs. It should not be necessary to recompile for C++ standards supported fully by GCC, such as the default standard. See also the compatibility section of the GCC manual.

Standard conformance

With each release, we try to make G++ conform closer to the ISO C++ standard.

Non-conforming legacy code that worked with older versions of GCC may be rejected by more recent compilers. There is no command-line switch to ensure compatibility in general, because trying to parse standard-conforming and old-style code at the same time would render the C++ front end unmaintainable. However, some non-conforming constructs are allowed when the command-line option -fpermissive is used.

The manual contains a section on Common Misunderstandings with GNU C++.

猪肝有什么功效 被虫咬了挂什么科 告诫是什么意思 吃什么可以自然掉体毛 尿胆素1十是什么意思
敲木鱼是什么意思 舌尖疼吃什么药 什么是自由度 早上起床腰疼是什么原因 长期手淫会有什么后果
疼痛科主要看什么病 孵化是什么意思 史记是什么体史书 婴儿大便有泡沫是什么原因 促排是什么意思
结婚九年是什么婚 johnson是什么品牌 前列腺增生吃什么药最好 梦到刷牙什么意思 吃什么食物可以降尿酸
做亲子鉴定需要什么hcv7jop4ns7r.cn 黄疸是什么原因引起的520myf.com 黄磊为什么不娶刘若英hcv8jop2ns4r.cn 掰弯了是什么意思chuanglingweilai.com 传媒公司主要做什么hcv8jop9ns3r.cn
veromoda是什么牌子hcv8jop3ns7r.cn 过生日送男朋友什么礼物好hcv9jop5ns4r.cn o型血和b型血生的孩子是什么血型hcv8jop6ns1r.cn 吊唁是什么意思inbungee.com 什么食物蛋白质含量高hcv8jop8ns3r.cn
搞怪是什么意思hcv7jop4ns7r.cn 脾肾阳虚吃什么中成药hanqikai.com 孕妇吃西红柿对胎儿有什么好处hcv8jop9ns9r.cn 顺位是什么意思hcv9jop5ns2r.cn 桓是什么意思mmeoe.com
期许是什么意思hcv7jop6ns8r.cn 脐带绕颈有什么症状hcv8jop6ns9r.cn 文献是什么hcv8jop9ns2r.cn 尿酸偏高是什么原因hcv8jop7ns7r.cn 骨加客念什么hcv7jop4ns7r.cn
百度