[Bug c++/71973] c++ handles built-in functions inconsistently

2017-10-07 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #10 from Bernd Edlinger  ---
(In reply to Paolo Carlini from comment #9)
> I see, maybe for clarity you could open a separate enhancement-type PR.

Done: pr82466

[Bug c++/71973] c++ handles built-in functions inconsistently

2017-10-07 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #9 from Paolo Carlini  ---
I see, maybe for clarity you could open a separate enhancement-type PR.

[Bug c++/71973] c++ handles built-in functions inconsistently

2017-10-07 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #8 from Bernd Edlinger  ---
Yes. fixed in 7.1.0

However, I wonder if I should do something when a variable
is declared with the same name as a builtin function.
Currently that aborts at runtime, but while C does warn,
C++ does not warn.

[Bug c++/71973] c++ handles built-in functions inconsistently

2017-10-07 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.0

--- Comment #7 from Paolo Carlini  ---
Then fixed in 7.1.0, right?


[Bug c++/71973] c++ handles built-in functions inconsistently

2016-11-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Mon Nov 21 18:55:11 2016
New Revision: 242677

URL: https://gcc.gnu.org/viewcvs?rev=242677=gcc=rev
Log:
PR c++/71973
* g++.dg/torture/pr53321.C (size_t): Use __SIZE_TYPE__ instead of
long unsigned int.
* g++.dg/torture/pr63512.C (::strlen): Use __SIZE_TYPE__ instead of
unsigned long.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/torture/pr53321.C
trunk/gcc/testsuite/g++.dg/torture/pr63512.C

[Bug c++/71973] c++ handles built-in functions inconsistently

2016-11-21 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #5 from Bernd Edlinger  ---
Author: edlinger
Date: Mon Nov 21 14:17:05 2016
New Revision: 242662

URL: https://gcc.gnu.org/viewcvs?rev=242662=gcc=rev
Log:
gcc:
2016-11-21  Bernd Edlinger  

PR c++/71973
* doc/invoke.texi (-Wno-builtin-declaration-mismatch): Document the
new default-enabled warning..
* builtin-types.def (BT_CONST_TM_PTR): New primitive type.
(BT_PTR_CONST_STRING): Updated.
(BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR): Removed.
(BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_TM_PTR): New function type.
* builtins.def (DEF_TM_BUILTIN): Disable BOTH_P for TM builtins.
(strftime): Update builtin function.
* tree-core.h (TI_CONST_TM_PTR_TYPE): New enum value.
* tree.h (const_tm_ptr_type_node): New type node.
* tree.c (free_lang_data, build_common_tree_nodes): Initialize
const_tm_ptr_type_node.

c-family:
2016-11-21  Bernd Edlinger  

PR c++/71973
* c.opt (-Wbuiltin-declaration-mismatch): New warning.
* c-common.c (c_common_nodes_and_builtins): Initialize
const_tm_ptr_type_node.

c:
2016-11-21  Bernd Edlinger  

PR c++/71973
* c-decl.c (diagnose_mismatched_decls): Use
OPT_Wbuiltin_declaration_mismatch here too.

cp:
2016-11-21  Bernd Edlinger  

PR c++/71973
* decl.c (duplicate_decls): Warn when a built-in function is redefined.
Don't overload builtin functions with C++ functions.
Handle const_tm_ptr_type_node like file_ptr_node.
Copy the TREE_NOTHROW flag unmodified to the old decl.

lto:
2016-11-21  Bernd Edlinger  

PR c++/71973
* lto-lang.c (lto_init): Assert const_tm_ptr_type_node is sane.

testsuite:
2016-11-21  Bernd Edlinger  

PR c++/71973
* g++.dg/pr71973-1.C: New test.
* g++.dg/pr71973-2.C: New test.
* g++.dg/pr71973-3.C: New test.
* g++.dg/lto/pr68811_0.C: Add -w to first lto-options.
* g++.dg/lookup/extern-c-redecl4.C: Adjust test expectations.
* g++.old-deja/g++.mike/p700.C: Add -Wno-builtin-declaration-mismatch
to dg-options.
* g++.old-deja/g++.other/realloc.C: Likewise.
* g++.old-deja/g++.other/builtins10.C: Adjust test expectations.

Added:
trunk/gcc/testsuite/g++.dg/pr71973-1.C
trunk/gcc/testsuite/g++.dg/pr71973-2.C
trunk/gcc/testsuite/g++.dg/pr71973-3.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtin-types.def
trunk/gcc/builtins.def
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/c-family/c.opt
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-decl.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/doc/invoke.texi
trunk/gcc/lto/ChangeLog
trunk/gcc/lto/lto-lang.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C
trunk/gcc/testsuite/g++.dg/lto/pr68811_0.C
trunk/gcc/testsuite/g++.old-deja/g++.mike/p700.C
trunk/gcc/testsuite/g++.old-deja/g++.other/builtins10.C
trunk/gcc/testsuite/g++.old-deja/g++.other/realloc.C
trunk/gcc/tree-core.h
trunk/gcc/tree.c
trunk/gcc/tree.h

[Bug c++/71973] c++ handles built-in functions inconsistently

2016-11-04 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #4 from Bernd Edlinger  ---
Author: edlinger
Date: Fri Nov  4 15:30:52 2016
New Revision: 241846

URL: https://gcc.gnu.org/viewcvs?rev=241846=gcc=rev
Log:
2016-11-04  Bernd Edlinger  

PR c++/71973
* g++.dg/cpp1y/lambda-generic-udt.C: Fix builtin function declaration.
* g++.dg/init/new15.C: Likewise.
* g++.dg/ipa/inline-1.C: Likewise.
* g++.dg/ipa/inline-2.C: Likewise.
* g++.dg/lto/20080908-1_0.C: Likewise.
* g++.dg/tc1/dr20.C: Likewise.
* g++.dg/tree-ssa/inline-1.C: Likewise.
* g++.dg/tree-ssa/inline-2.C: Likewise.
* g++.old-deja/g++.law/except1.C: Likewise.
* g++.old-deja/g++.other/vbase5.C: Likewise.
* obj-c++.dg/lto/trivial-1_0.mm: Likewise.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-udt.C
trunk/gcc/testsuite/g++.dg/init/new15.C
trunk/gcc/testsuite/g++.dg/ipa/inline-1.C
trunk/gcc/testsuite/g++.dg/ipa/inline-2.C
trunk/gcc/testsuite/g++.dg/lto/20080908-1_0.C
trunk/gcc/testsuite/g++.dg/tc1/dr20.C
trunk/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
trunk/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
trunk/gcc/testsuite/g++.old-deja/g++.law/except1.C
trunk/gcc/testsuite/g++.old-deja/g++.other/vbase5.C
trunk/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm

[Bug c++/71973] c++ handles built-in functions inconsistently

2016-08-18 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #3 from Bernd Edlinger  ---
Created attachment 39472
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39472=edit
possible patch

Oh, yeah!

Boot-strap OK.

The eh-code is OK.

BUT: the warning triggers a few hundred times, within the g++.dg testsuite,
and all of the places look like real bugs, that deserve a warning...

FAIL: g++.dg/charset/asm2.c  -std=c++98 (test for excess errors)
FAIL: g++.dg/charset/asm2.c  -std=c++11 (test for excess errors)
FAIL: g++.dg/charset/asm2.c  -std=c++14 (test for excess errors)
FAIL: g++.dg/debug/dwarf2/template-func-params-7.C  -std=gnu++11 (test for
excess errors)
FAIL: g++.dg/debug/dwarf2/template-func-params-7.C  -std=gnu++14 (test for
excess errors)
FAIL: g++.dg/addr_builtin-1.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/addr_builtin-1.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/addr_builtin-1.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp0x/constexpr-builtin1.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/cpp0x/constexpr-builtin1.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp0x/constexpr-function2.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/cpp0x/constexpr-function2.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp0x/constexpr-pos1.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/cpp0x/constexpr-pos1.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp0x/gen-attrs-40.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/cpp0x/gen-attrs-40.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp1y/lambda-generic-udt.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/cpp1y/lambda-generic-xudt.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/diagnostic/pr70105.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/diagnostic/pr70105.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/diagnostic/pr70105.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ext/attrib40.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/ext/attrib40.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/ext/attrib40.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/init/new15.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/init/new15.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/init/new15.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/init/ref9.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/init/ref9.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/init/ref9.C  -std=c++14 (test for excess errors)
AIL: g++.dg/ipa/inline-1.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ipa/inline-1.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ipa/inline-1.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ipa/inline-2.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ipa/inline-2.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ipa/inline-2.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/lookup/builtin1.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/lookup/builtin1.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/lookup/builtin1.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/lookup/builtin3.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/lookup/builtin3.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/lookup/builtin3.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/lookup/builtin5.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/lookup/builtin5.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/lookup/builtin7.C  -std=c++98 (test for excess errors)
FAIL: g++.dg/lookup/builtin7.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/lookup/builtin7.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/lookup/extern-c-redecl4.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/lookup/extern-c-redecl4.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/lookup/extern-c-redecl4.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/opt/cfg1.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/opt/cfg1.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/opt/cfg1.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/opt/conj1.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/opt/conj1.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/opt/conj1.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/opt/conj2.C  -std=c++11 (test for excess errors)
FAIL: g++.dg/opt/conj2.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/opt/copysign-1.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/opt/copysign-1.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/opt/copysign-1.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/opt/pr17724-5.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/opt/pr17724-5.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/opt/pr17724-5.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/opt/pr17724-6.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/opt/pr17724-6.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/opt/pr17724-6.C  -std=gnu++14 (test 

[Bug c++/71973] c++ handles built-in functions inconsistently

2016-07-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

Martin Sebor  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-22
 CC||msebor at gcc dot gnu.org
 Ever confirmed|0   |1
  Known to fail||4.5.3, 4.8.3, 4.9.3, 5.3.0,
   ||6.1.0, 7.0

--- Comment #2 from Martin Sebor  ---
Confirmed.  It doesn't look like G++ ever rejected such invalid code.

[Bug c++/71973] c++ handles built-in functions inconsistently

2016-07-22 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973

--- Comment #1 from Bernd Edlinger  ---
the bug goes away, if the fork signature is correct.


extern "C"
int fork () __attribute__((nothrow));

void bar () throw()
{
  fork ();
}

does the right thing.