[13703] in Athena Bugs

home help back first fref pref prev next nref lref last post

gcc bounds

daemon@ATHENA.MIT.EDU (Pete Wyckoff)
Mon Jul 31 12:06:10 1995

To: bugs@MIT.EDU
Date: Mon, 31 Jul 1995 12:05:58 EDT
From: Pete Wyckoff <petew@MIT.EDU>

When using gcc with bounds checking on a sun4m_53, the following program
produces an odd result:
    main()
    {
	printf("foo\n");
    }

Compiled with:
    gcc -V2.7.0 -fbounds-checking -o x x.c

It aborts, printing:
  Bounds error: invalid destination pointer used in memcpy.
  Pointer value: 0xef7b8c38
Abort

Code which does not call printf() or fprintf() seems to work correctly, and
writing outside of array bounds is detected and reported properly.

Incidentally, replacing all occurances of printf() with
    { char s[..]; sprintf(s, ..); fputs(s, stdout); }
works around the problem.

				-- Pete (pw)

home help back first fref pref prev next nref lref last post