ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: "Denis G. Samsonenko" <d.g.samsonenko@gmail.com>
To: community@lists.altlinux.org
Subject: [Comm] gcc: странности с оптимизацией
Date: Sat, 16 Jun 2012 21:59:16 +0700
Message-ID: <CAFE-3Xas+2L3PhiJpzubUU94SvkH2hUDjsna2VL7OeyBHTO6Rw@mail.gmail.com> (raw)

Добрый день!

Хотел бы спросить у специалистов по GCC.

Я собираю одну прогу, написанную на фортране. Если я её собираю с
ключом -O0, то она работает после этого нормально. Если же я собираю
её хотя бы с -O1, то она падает с сообщением "*** buffer overflow
detected ***".

Попытался разобраться, какая именно оптимизация приводит к такому
поведению. На сколько я смог выяснить, разница между -O0 и -O1 состоит
с следующем (выяснял при помощи запуска g77 -O1 -Q --help=optimizers,
а так же добавлением -S -fverbose-asm при компиляции и анализом шапки
в получающемся *.s):

-fcprop-registers
-fdefer-pop
-fforward-propagate
-fguess-branch-probability
-fif-conversion
-fif-conversion2
-finline
-fipa-pure-const
-fipa-reference
-fmerge-constants
-fsplit-wide-types
-ftoplevel-reorder
-ftree-ccp
-ftree-ch
-ftree-copy-prop
-ftree-copyrename
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-fre
-ftree-sink
-ftree-sra
-ftree-ter
-fvar-tracking
-fvar-tracking-assignments

Однако сборка с -O0 с добавленными выше перечисленных опций приводит
бинарнику, отличному от получаемого при сборке с ключом -O1. При этом
получающийся бинарник не падает.

Получается, использование -O0 с выше перечисленными опциями не
идентично использованию -O1. Что ещё такого делает -O1 и как это
узнать и отключить?

-- 
Всего доброго,

Денис.

                 reply	other threads:[~2012-06-16 14:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFE-3Xas+2L3PhiJpzubUU94SvkH2hUDjsna2VL7OeyBHTO6Rw@mail.gmail.com \
    --to=d.g.samsonenko@gmail.com \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git