Re: [PATCH] BFD: Fix unmatched #ifndef and #endif

2016-05-28 Thread Honggyu Kim
On Sun, May 29, 2016 at 10:26:39AM +0900, Honggyu Kim wrote:
> bfd/bfd-in.h has '#ifndef __BFD_H_SEEN__' statement at the beginning of
> the header file but do not have '#endif' at the end.
> 
>   * bfd/bfd-in.h: Add #endif statment
I just found my mistake. Sorry that I sent this to wrong mailing list.
It should have gone to gdb mailing list.

Honggyu


[PATCH] BFD: Fix unmatched #ifndef and #endif

2016-05-28 Thread Honggyu Kim
bfd/bfd-in.h has '#ifndef __BFD_H_SEEN__' statement at the beginning of
the header file but do not have '#endif' at the end.

* bfd/bfd-in.h: Add #endif statment
---
 bfd/bfd-in.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 196bd70..ba36ee1 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -1026,3 +1026,5 @@ extern bfd_boolean v850_elf_create_sections
 
 extern bfd_boolean v850_elf_set_note
   (bfd *, unsigned int, unsigned int);
+
+#endif
-- 
1.9.1



[PATCH] Make maybe_cast_to_ptrmode function as static

2015-03-29 Thread Honggyu Kim
Hi,

This patch makes maybe_cast_to_ptrmode function in asan.c as static
because the function is not called outside of the file.
Is it okay for trunk?

Honggyu

2015-03-30  Honggyu Kim  

* asan.c (maybe_cast_to_ptrmode): Make static.
---
 gcc/asan.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/asan.c b/gcc/asan.c
index 9e4a629..c9c8773 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1650,7 +1650,7 @@ maybe_create_ssa_name (location_t loc, tree base, 
gimple_stmt_iterator *iter,
 /* LEN can already have necessary size and precision;
in that case, do not create a new variable.  */
 
-tree
+static tree
 maybe_cast_to_ptrmode (location_t loc, tree len, gimple_stmt_iterator *iter,
   bool before_p)
 {
-- 
1.7.9.5



Re: [PATCH v2] New testcase to check parameter passing bug

2015-03-29 Thread Honggyu Kim
On Wed, Mar 25, 2015 at 02:05:37PM -, Kyrill Tkachov wrote:
> 
> 
> > -Original Message-
> > From: Jeff Law [mailto:l...@redhat.com]
> > Sent: 25 March 2015 12:27
> > To: Honggyu Kim; gcc-patches@gcc.gnu.org
> > Cc: Kyrylo Tkachov; seg...@kernel.crashing.org; christophe.l...@st.com
> > Subject: Re: [PATCH v2] New testcase to check parameter passing bug
> > 
> > On 03/18/15 19:40, Honggyu Kim wrote:
> > > Hi,
> > >
> > > I have modified the test-case to check parameter passing bug based on
> > > the comments from Kyrill Tkachov, Christophe Lyon, and Segher
> > > Boessenkool as follows:
> > >   1. move from "gcc.target/arm" to "gcc.dg"
> > >   2. change "dg-do compile" to "dg-do run"
> > >
> > > Please let me know if there's still something to fix more.
> > > Thanks for your comment.
> > >
> > > Honggyu
> > > ---
> > >   gcc/testsuite/ChangeLog|4 
> > >   gcc/testsuite/gcc.dg/pr65358.c |   33
> > +
> > >   2 files changed, 37 insertions(+)
> > >   create mode 100644 gcc/testsuite/gcc.dg/pr65358.c
> > >
> > > diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index
> > > 77d24a1..218f908 100644
> > > --- a/gcc/testsuite/ChangeLog
> > > +++ b/gcc/testsuite/ChangeLog
> > > @@ -1,3 +1,7 @@
> > > +2015-03-19  Honggyu Kim  
> > > +
> > > + * gcc.dg/pr65358.c: New test.
> > This should be included as part of Kyrill's patch.  If the test goes in
> without
> > Kryill's fix, then it'll just create testsuite noise.
> 
> I'll make sure to commit this together with my fix (at
> https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01014.html)
> if it gets approved. I agree that there's no point taking the test in by
> itself .
> 
> Thanks,
> Kyrill
> 
> > 
> > Jeff
> > 

I have tested Kyrill's patch and it works fine.
Thanks for all your comments.
Especially, Mikael Pettersson's help for this testcase.

Honggyu


Re: [PATCH][expr.c] PR 65358 Avoid clobbering partial argument during sibcall

2015-03-29 Thread Honggyu Kim
On Thu, Mar 19, 2015 at 02:39:11PM +, Kyrill Tkachov wrote:
> Hi all,
> 
> This patch fixes PR 65358. For details look at the excellent write-up
> by Honggyu in bugzilla. The problem is that we're trying to pass a struct
> partially on the stack and partially in regs during a tail-call optimisation
> but the struct we're passing is also a partial incoming arg though the split
> between stack and regs is different from its outgoing usage.
> 
> The emit_push_insn code ends up doing a block move for the on-stack part but
> ends up overwriting the part that needs to be loaded into regs.
> My first thought was to just load the regs part first and then do the stack
> part but that doesn't work as multiple comments in that function indicate
> (the block move being expanded to movmem or other functions being one of the
> reasons).
> 
> My proposed solution is to detect when the overlap happens, find the
> overlapping region and load it before the stack pushing into pseudos and
> after the stack pushing is done move the overlapping values from the pseudos
> into the hard argument regs that they're supposed to go.
> 
> That way this new functionality should only ever be triggered when there's
> the overlap in this PR (causing wrong-code) and shouldn't affect codegen
> anywhere else.
> 
> Bootstrapped and tested on arm-none-linux-gnueabihf, aarch64-none-linux-gnu
> and x86_64-linux-gnu.
> 
> According to the PR this appears at least as far back 4.6 so this isn't a
> regression on the release branches, but it is a wrong-code bug.
> 
> I'll let Honggyu upstream the testcase separately
> (https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00984.html)
> 
> I'll be testing this on the 4.8 and 4.9 branches.
> Thoughts on this approach?
> 
> Thanks,
> Kyrill
> 
Hi, Kyrill

I have verified the generated assembly code and tested on the target board.
PR 65358 testcase works fine now with your patch.
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00984.html

Here is the generated assembly code of PR 65358:

foo:(without this patch)|(with this patch)
sub sp, sp, #8  |sub sp, sp, #8
mov r0, r1  |mov r0, r1
str lr, [sp, #-4]!  |str lr, [sp, #-4]!
add ip, sp, #8  |mov r1, r2
(1) ldr lr, [sp, #16]   |ldr lr, [sp, #16]
mov r1, r2  |mov r2, r3
str r3, [sp, #8]|ldr ip, [sp, #12]
(2) str lr, [sp, #12]   |str r3, [sp, #8]
ldr lr, [sp], #4|str lr, [sp, #12]
ldmia   ip, {r2, r3}|ldr lr, [sp], #4
add sp, sp, #8  |mov r3, ip
b   bar |add sp, sp, #8
|b   bar
 
One the left side(previous code), (1) loads "p.killer", then (2) overwrites
"p.victim" value.
Until this point, "p.victim" is never copied anyway, which makes the
value disappear.

But this bug is clearly fixed with this patch as shown on the right side.

I have tested on x86_64 and got the working code regardless of having
this patch.

I appreciate your patch, Kyrill.

Honggyu



Re: [PATCH v2] New testcase to check parameter passing bug

2015-03-18 Thread Honggyu Kim
On Thu, Mar 19, 2015 at 10:40:44AM +0900, Honggyu Kim wrote:
> ---
>  gcc/testsuite/ChangeLog|4 
>  gcc/testsuite/gcc.dg/pr65358.c |   33 +
>  2 files changed, 37 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/pr65358.c
> 
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index 77d24a1..218f908 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> 
I'm kind of new to gcc community and I'm used to send a patch throught
git send-email. If you have other preferable way, please let me know.
I will try to follow the format and style more like other gcc patches.
Thanks you all.

Honggyu


[PATCH v2] New testcase to check parameter passing bug

2015-03-18 Thread Honggyu Kim
Hi,

I have modified the test-case to check parameter passing bug based on the
comments from Kyrill Tkachov, Christophe Lyon, and Segher Boessenkool
as follows:
 1. move from "gcc.target/arm" to "gcc.dg"
 2. change "dg-do compile" to "dg-do run"

Please let me know if there's still something to fix more.
Thanks for your comment.

Honggyu
---
 gcc/testsuite/ChangeLog|4 
 gcc/testsuite/gcc.dg/pr65358.c |   33 +
 2 files changed, 37 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr65358.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 77d24a1..218f908 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-19  Honggyu Kim  
+
+   * gcc.dg/pr65358.c: New test.
+
 2015-03-18  Paolo Carlini  
 
PR c++/59816
diff --git a/gcc/testsuite/gcc.dg/pr65358.c b/gcc/testsuite/gcc.dg/pr65358.c
new file mode 100644
index 000..ba89fd4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr65358.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+struct pack
+{
+  int fine;
+  int victim;
+  int killer;
+};
+
+int __attribute__ ((__noinline__, __noclone__))
+bar (int a, int b, struct pack p)
+{
+  if (a != 20 || b != 30)
+__builtin_abort ();
+  if (p.fine != 40 || p.victim != 50 || p.killer != 60)
+__builtin_abort ();
+  return 0;
+}
+
+int __attribute__ ((__noinline__, __noclone__))
+foo (int arg1, int arg2, int arg3, struct pack p)
+{
+  return bar (arg2, arg3, p);
+}
+
+int main (void)
+{
+  struct pack p = { 40, 50, 60 };
+
+  (void) foo (10, 20, 30, p);
+  return 0;
+}
-- 
1.7.9.5



RE: [PATCH][ARM] New testcase to check parameter passing bug

2015-03-15 Thread Honggyu Kim
Hi,

I have modified and moved the testcase following your comments.
(from gcc.target/arm to gcc.dg)
Please let me know if there's still something to fix more.
I appreciate all your comments.

Honggyu
---
 gcc/testsuite/ChangeLog|4 
 gcc/testsuite/gcc.dg/pr65358.c |   33 +
 2 files changed, 37 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr65358.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5302dbd..5dcf2cf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-16  Honggyu Kim  
+
+   * gcc.dg/pr65358.c: New test.
+
 2015-03-15  John David Anglin  
 
* gcc.dg/torture/pr65270-1.c: Add -fno-common to dg-options on
diff --git a/gcc/testsuite/gcc.dg/pr65358.c b/gcc/testsuite/gcc.dg/pr65358.c
new file mode 100644
index 000..3790764
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr65358.c
@@ -0,0 +1,33 @@
+/* { dg-do run */
+/* { dg-options "-O2" } */
+
+struct pack
+{
+  int fine;
+  int victim;
+  int killer;
+};
+
+int __attribute__ ((__noinline__, __noclone__))
+bar (int a, int b, struct pack p)
+{
+  if (a != 20 || b != 30)
+__builtin_abort ();
+  if (p.fine != 40 || p.victim != 50 || p.killer != 60)
+__builtin_abort ();
+  return 0;
+}
+
+int __attribute__ ((__noinline__, __noclone__))
+foo (int arg1, int arg2, int arg3, struct pack p)
+{
+  return bar (arg2, arg3, p);
+}
+
+int main (void)
+{
+  struct pack p = { 40, 50, 60 };
+
+  (void) foo (10, 20, 30, p);
+  return 0;
+}
-- 
1.7.9.5




[PATCH][ARM] New testcase to check parameter passing bug

2015-03-12 Thread Honggyu Kim
Hi,

I have wrote a testcase that reproduces argument overwriting bug during arm
code generation.

I wrote this testcase with the help of Mikael Pettersson.
If some format is not proper to run in gcc testsuite framework, please
correct me.

Please refer to the following bugzilla link for details:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65358

Honggyu
---
 gcc/testsuite/ChangeLog|5 +
 gcc/testsuite/gcc.target/arm/pr65358.c |   34 
 2 files changed, 39 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/arm/pr65358.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5302dbd..9acd12a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-13  Honggyu Kim  
+
+   PR target/65235
+   * gcc.target/arm/pr65358.c: New test for sibcall argument passing bug.
+
 2015-03-12  Kyrylo Tkachov  
 
PR rtl-optimization/65235
diff --git a/gcc/testsuite/gcc.target/arm/pr65358.c 
b/gcc/testsuite/gcc.target/arm/pr65358.c
new file mode 100644
index 000..d663dcf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr65358.c
@@ -0,0 +1,34 @@
+/* PR target/65358 */
+/* { dg-do compile { target arm*-*-* } } */
+/* { dg-options "-O2" } */
+
+struct pack
+{
+  int fine;
+  int victim;
+  int killer;
+};
+
+int __attribute__ ((__noinline__, __noclone__))
+bar (int a, int b, struct pack p)
+{
+  if (a != 20 || b != 30)
+__builtin_abort ();
+  if (p.fine != 40 || p.victim != 50 || p.killer != 60)
+__builtin_abort ();
+  return 0;
+}
+
+int __attribute__ ((__noinline__, __noclone__))
+foo (int arg1, int arg2, int arg3, struct pack p)
+{
+  return bar (arg2, arg3, p);
+}
+
+int main (void)
+{
+  struct pack p = { 40, 50, 60 };
+
+  (void) foo (10, 20, 30, p);
+  return 0;
+}
-- 
1.7.9.5



RE: [PATCH] doc/generic.texi: Fix typo

2014-08-31 Thread Honggyu Kim
On 9/1/2014 5:50 AM, Gerald Pfeifer wrote:

> Since this now came up for the second time this year, I went ahead and
> applied the patch below.
Thanks for the comment :)

Honggyu



RE: [PATCH] doc/generic.texi: Fix typo

2014-08-31 Thread Honggyu Kim
On 9/1/2014 7:11 AM, Robert Dewar wrote:

> Seems a shame that anyone should need an explanation, but oh well :-)
Sorry about that. I should have thought about it twice :)

> P.S. my favorite instance of this kind of documentation is an early IBM
> Fortran manual, which says that you should put exactly the character you
> want to see come out on the printer [in some context], "e.g. an I for an I
> and a 2 for a 2." :-)
Maybe I should learn something for that document :)

Thanks,
 
Honggyu



[PATCH] doc/generic.texi: Fix typo

2014-08-28 Thread Honggyu Kim
This fixes some typo errors in the gcc internal document.

2014-08-29  Honggyu Kim  

* doc/generic.texi: Fix typo.
---
 gcc/ChangeLog|4 
 gcc/doc/generic.texi |2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ac5dc7c..01698e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-29  Honggyu Kim  
+
+   * doc/generic.texi: Fix typo.
+
 2014-08-29  David Malcolm  
 
PR bootstrap/62300
diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
index 4476f28..a598500 100644
--- a/gcc/doc/generic.texi
+++ b/gcc/doc/generic.texi
@@ -53,7 +53,7 @@ seems inelegant.
 @node Deficiencies
 @section Deficiencies
 
-There are many places in which this document is incomplet and incorrekt.
+There are many places in which this document is incomplete or incorrect.
 It is, as of yet, only @emph{preliminary} documentation.
 
 @c -
-- 
1.7.9.5



[PATCH] 2014-08-29 Honggyu Kim

2014-08-28 Thread Honggyu Kim
* doc/generic.texi: Fix typo.
---
 gcc/ChangeLog|4 
 gcc/doc/generic.texi |2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ac5dc7c..01698e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-29  Honggyu Kim  
+
+   * doc/generic.texi: Fix typo.
+
 2014-08-29  David Malcolm  
 
PR bootstrap/62300
diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
index 4476f28..a598500 100644
--- a/gcc/doc/generic.texi
+++ b/gcc/doc/generic.texi
@@ -53,7 +53,7 @@ seems inelegant.
 @node Deficiencies
 @section Deficiencies
 
-There are many places in which this document is incomplet and incorrekt.
+There are many places in which this document is incomplete or incorrect.
 It is, as of yet, only @emph{preliminary} documentation.
 
 @c -
-- 
1.7.9.5