public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module @ 2009-06-18 9:20 ivan dot glushkov at gmail dot com 2009-06-18 9:36 ` [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed rguenth at gcc dot gnu dot org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: ivan dot glushkov at gmail dot com @ 2009-06-18 9:20 UTC (permalink / raw) To: gcc-bugs Hello. gcc always replaces the name of the defined "__builtin_abs()" with "abs()". And it might cause the error if we also wants to define "abs()" function: $ cat t.c int abs(int a) {return 0;} int __builtin_abs(int a) {return 0;} int main(void) { return (abs(-3) + __builtin_abs(-3)); } $ gcc t.c -c /tmp/ccdecizd.s: Assembler messages: /tmp/ccdecizd.s:14: Error: symbol `abs' is already defined In the case of "static" functions it's OK: $ cat t.c static int abs(int a) {return 0;} static int __builtin_abs(int a) {return 0;} int main(void) { return (abs(-3) + __builtin_abs(-3)); } $ gcc t.c -c ; echo $? 0 In this case we use unchanged names for the functions' call: $ gcc t.c -S && grep call t.s call abs call __builtin_abs This issue doesn't occur only on abs but also with the others builtins. $ ~/programs/gcc-4.4.0/bin/gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ./configure --prefix=/home/glushkov/programs/gcc-4.4.0 --enable-languages=c,c++ Thread model: posix gcc version 4.4.0 (GCC) $ uname -a Linux expert 2.6.23-gentoo-r9-c2-uni1 #1 SMP Thu Jun 5 13:00:21 MSD 2008 i686 Intel(R) Pentium(R) 4 CPU 3.40GHz GenuineIntel GNU/Linux -- Summary: definitions of __builtin_abs() and abs() function in one module Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ivan dot glushkov at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com @ 2009-06-18 9:36 ` rguenth at gcc dot gnu dot org 2009-06-18 9:48 ` ivan dot glushkov at gmail dot com ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-06-18 9:36 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from rguenth at gcc dot gnu dot org 2009-06-18 09:35 ------- This is really invalid code, but we should diagnose it. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |accepts-invalid Last reconfirmed|0000-00-00 00:00:00 |2009-06-18 09:35:53 date| | Summary|definitions of |definitions of |__builtin_abs() and abs() |__builtin_abs() and abs() |function in one module |function in one module not | |diagnosed Version|unknown |4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com 2009-06-18 9:36 ` [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed rguenth at gcc dot gnu dot org @ 2009-06-18 9:48 ` ivan dot glushkov at gmail dot com 2009-06-18 13:48 ` rguenth at gcc dot gnu dot org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: ivan dot glushkov at gmail dot com @ 2009-06-18 9:48 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from ivan dot glushkov at gmail dot com 2009-06-18 09:48 ------- Why invalid? And why non-static is not invalid? Can you please give me reference to documentation where it's described? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com 2009-06-18 9:36 ` [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed rguenth at gcc dot gnu dot org 2009-06-18 9:48 ` ivan dot glushkov at gmail dot com @ 2009-06-18 13:48 ` rguenth at gcc dot gnu dot org 2009-06-18 14:51 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-06-18 13:48 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from rguenth at gcc dot gnu dot org 2009-06-18 13:48 ------- The __builtin_ namespace is reserved by GCC. There may be documentation missing for this fact. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com ` (2 preceding siblings ...) 2009-06-18 13:48 ` rguenth at gcc dot gnu dot org @ 2009-06-18 14:51 ` pinskia at gcc dot gnu dot org 2009-06-18 21:09 ` joseph at codesourcery dot com 2009-06-21 22:46 ` pinskia at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2009-06-18 14:51 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from pinskia at gcc dot gnu dot org 2009-06-18 14:51 ------- All of __* namespace s reserved for the implementor. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com ` (3 preceding siblings ...) 2009-06-18 14:51 ` pinskia at gcc dot gnu dot org @ 2009-06-18 21:09 ` joseph at codesourcery dot com 2009-06-21 22:46 ` pinskia at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: joseph at codesourcery dot com @ 2009-06-18 21:09 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from joseph at codesourcery dot com 2009-06-18 21:08 ------- Subject: Re: definitions of __builtin_abs() and abs() function in one module not diagnosed What happened to the patch for PR 32455 to disallow __builtin_* declarations? That PR indicates it was approved for 4.5. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com ` (4 preceding siblings ...) 2009-06-18 21:09 ` joseph at codesourcery dot com @ 2009-06-21 22:46 ` pinskia at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2009-06-21 22:46 UTC (permalink / raw) To: gcc-bugs ------- Comment #6 from pinskia at gcc dot gnu dot org 2009-06-21 22:45 ------- *** This bug has been marked as a duplicate of 32455 *** -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40485 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-06-21 22:46 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-06-18 9:20 [Bug c/40485] New: definitions of __builtin_abs() and abs() function in one module ivan dot glushkov at gmail dot com 2009-06-18 9:36 ` [Bug c/40485] definitions of __builtin_abs() and abs() function in one module not diagnosed rguenth at gcc dot gnu dot org 2009-06-18 9:48 ` ivan dot glushkov at gmail dot com 2009-06-18 13:48 ` rguenth at gcc dot gnu dot org 2009-06-18 14:51 ` pinskia at gcc dot gnu dot org 2009-06-18 21:09 ` joseph at codesourcery dot com 2009-06-21 22:46 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).