public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38944]  New: internal compiler error: Segmentation faul
@ 2009-01-23 12:20 a dot fiaschi at ao-pisa dot toscana dot it
  2009-01-23 17:02 ` [Bug c/38944] " ubizjak at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: a dot fiaschi at ao-pisa dot toscana dot it @ 2009-01-23 12:20 UTC (permalink / raw)
  To: gcc-bugs

comiling common.c of conky-1.6.1 
CFLAGS="-O2 -march=native -mtune=native -pipe -fomit-frame-pointer -ffast-math"

i486-slackware-linux-gcc -DHAVE_CONFIG_H -I.
-DSYSTEM_CONFIG_FILE=\"/etc/conky/c
onky.conf\"    -O2 -march=native -mtune=native -pipe -fomit-frame-pointer
-ffast
-math -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/includ
e/gtk-2.0 -I/usr/include/pango-1.0 -I/usr/include/cairo
-I/usr/include/libmowgli
 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/freetype2 -I/usr/include/libpng12
-I/usr/i
nclude/pixman-1   -I/usr/include/libxml2           -I/usr/include/freetype2  
-I
/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -Wall -W -MT common.o -MD
-M
P -MF .deps/common.Tpo -c -o common.o common.c
common.c: In function 'update_stuff':
common.c:399: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [common.o] Error 1
make[2]: Leaving directory `/tmp/SBo/conky-1.6.1/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/SBo/conky-1.6.1/src'
make: *** [all-recursive] Error 1

source :
/* Conky, a system monitor, based on torsmo
 *
 * Any original torsmo code is licensed under the BSD license
 *
 * All code written since the fork of torsmo is licensed under the GPL
 *
 * Please see COPYING for details
 *
 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
 * Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
 *      (see AUTHORS)
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * $Id: common.c 1193 2008-06-21 20:37:58Z ngarofil $ */

#include "conky.h"
#include <ctype.h>
#include <errno.h>
#include <sys/time.h>
#include <pthread.h>

#ifndef HAVE_STRNDUP
// use our own strndup() if it's not available
char *strndup(const char *s, size_t n)
{
        if (strlen(s) + 1 > n) {
                char *ret = malloc(n);
                strncpy(ret, s, n);
                return ret;
        } else {
                return strdup(s);
        }
}
#endif /* HAVE_STRNDUP */

void update_uname(void)
{
        uname(&info.uname_s);
}

double get_time(void)
{
        struct timeval tv;

        gettimeofday(&tv, 0);
        return tv.tv_sec + (tv.tv_usec / 1000000.0);
}

FILE *open_file(const char *file, int *reported)
{
        FILE *fp = fopen(file, "r");

        if (!fp) {
                if (!reported || *reported == 0) {
                        ERR("can't open %s: %s", file, strerror(errno));
                        if (reported) {
                                *reported = 1;
                        }
                }
                return 0;
        }

        return fp;
}

void variable_substitute(const char *s, char *dest, unsigned int n)
{
        while (*s && n > 1) {
                if (*s == '$') {
                        s++;
                        if (*s != '$') {
                                char buf[256];
                                const char *a, *var;
                                unsigned int len;

                                /* variable is either $foo or ${foo} */
                                if (*s == '{') {
                                        s++;
                                        a = s;
                                        while (*s && *s != '}') {
                                                s++;
                                        }
                                } else {
                                        a = s;
                                        while (*s && (isalnum((int) *s) || *s
== '_')) {
                                                s++;
                                        }
                                }

                                /* copy variable to buffer and look it up */
                                len = (s - a > 255) ? 255 : (s - a);
                                strncpy(buf, a, len);
                                buf[len] = '\0';

                                if (*s == '}') {
                                        s++;
                                }

                                var = getenv(buf);

                                if (var) {
                                        /* add var to dest */
                                        len = strlen(var);
                                        if (len >= n) {
                                                len = n - 1;
                                        }
                                        strncpy(dest, var, len);
                                        dest += len;
                                        n -= len;
                                }
                                continue;
                        }
                }

                *dest++ = *s++;
                n--;
        }

        *dest = '\0';
}

/* network interface stuff */

static struct net_stat netstats[16];

struct net_stat *get_net_stat(const char *dev)
{
        unsigned int i;

        if (!dev) {
                return 0;
        }

        /* find interface stat */
        for (i = 0; i < 16; i++) {
                if (netstats[i].dev && strcmp(netstats[i].dev, dev) == 0) {
                        return &netstats[i];
                }
        }

        /* wasn't found? add it */
        if (i == 16) {
                for (i = 0; i < 16; i++) {
                        if (netstats[i].dev == 0) {
                                netstats[i].dev = strndup(dev,
text_buffer_size);
                                return &netstats[i];
                        }
                }
        }

        CRIT_ERR("too many interfaces used (limit is 16)");
        return 0;
}

void clear_net_stats(void)
{
        memset(netstats, 0, sizeof(netstats));
}

void free_dns_data(void)
{
        int i;
        struct dns_data *data = &info.nameserver_info;
        for (i = 0; i < data->nscount; i++)
                free(data->ns_list[i]);
        if (data->ns_list)
                free(data->ns_list);
        memset(data, 0, sizeof(struct dns_data));
}

//static double last_dns_update;

void update_dns_data(void)
{
        FILE *fp;
        char line[256];
        struct dns_data *data = &info.nameserver_info;

        /* maybe updating too often causes higher load because of /etc lying on
a real FS
        if (current_update_time - last_dns_update < 10.0)
                return;
        else
                last_dns_update = current_update_time;
        */

        free_dns_data();

        if ((fp = fopen("/etc/resolv.conf", "r")) == NULL)
                return;
        while(!feof(fp)) {
                if (fgets(line, 255, fp) == NULL) {
                        break;
                }
                if (!strncmp(line, "nameserver ", 11)) {
                        line[strlen(line) - 1] = '\0';  // remove trailing
newline
                        data->nscount++;
                        data->ns_list = realloc(data->ns_list, data->nscount *
sizeof(char *));
                        data->ns_list[data->nscount - 1] = strndup(line + 11,
text_buffer_size);
                }
        }
        fclose(fp);
}

void format_seconds(char *buf, unsigned int n, long seconds)
{
        long days;
        int hours, minutes;

        days = seconds / 86400;
        seconds %= 86400;
        hours = seconds / 3600;
        seconds %= 3600;
        minutes = seconds / 60;
        seconds %= 60;

        if (days > 0) {
                snprintf(buf, n, "%ldd %dh %dm", days, hours, minutes);
        } else {
                snprintf(buf, n, "%dh %dm %lds", hours, minutes, seconds);
        }
}

void format_seconds_short(char *buf, unsigned int n, long seconds)
{
        long days;
        int hours, minutes;

        days = seconds / 86400;
        seconds %= 86400;
        hours = seconds / 3600;
        seconds %= 3600;
        minutes = seconds / 60;
        seconds %= 60;

        if (days > 0) {
                snprintf(buf, n, "%ldd %dh", days, hours);
        } else if (hours > 0) {
                snprintf(buf, n, "%dh %dm", hours, minutes);
        } else {
                snprintf(buf, n, "%dm %lds", minutes, seconds);
        }
}

static double last_meminfo_update;
static double last_fs_update;

unsigned long long need_mask;

#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))

void update_stuff(void)
{
        unsigned int i;

        info.mask = 0;

        if (no_buffers) {
                need_mask |= 1 << INFO_BUFFERS;
        }

        /* clear speeds and up status in case device was removed and doesn't
get
         * updated */

        for (i = 0; i < 16; i++) {
                if (netstats[i].dev) {
                        netstats[i].up = 0;
                        netstats[i].recv_speed = 0.0;
                        netstats[i].trans_speed = 0.0;
                }
        }

        prepare_update();

        if (NEED(INFO_UPTIME)) {
                update_uptime();
        }

        if (NEED(INFO_PROCS)) {
                update_total_processes();
        }

        if (NEED(INFO_RUN_PROCS)) {
                update_running_processes();
        }

        if (NEED(INFO_CPU)) {
                update_cpu_usage();
        }

        if (NEED(INFO_NET)) {
                update_net_stats();
        }

        if (NEED(INFO_DISKIO)) {
                update_diskio();
        }

#if defined(__linux__)
        if (NEED(INFO_I8K)) {
                update_i8k();
        }
#endif /* __linux__ */

#ifdef MPD
        if (NEED(INFO_MPD)) {
                if (!info.mpd.timed_thread) {
                        init_mpd_stats(&info.mpd);
                        info.mpd.timed_thread =
timed_thread_create(&update_mpd,
                                (void *) &info.mpd, info.music_player_interval
* 1000000);
                        if (!info.mpd.timed_thread) {
                                ERR("Failed to create MPD timed thread");
                        }
                        timed_thread_register(info.mpd.timed_thread,
&info.mpd.timed_thread);
                        if (timed_thread_run(info.mpd.timed_thread)) {
                                ERR("Failed to run MPD timed thread");
                        }
                }
        }
#endif

#ifdef XMMS2
        if (NEED(INFO_XMMS2)) {
                update_xmms2();
        }
#endif

#ifdef AUDACIOUS
        if (NEED(INFO_AUDACIOUS)) {
                update_audacious();
        }
#endif

#ifdef BMPX
        if (NEED(INFO_BMPX)) {
                update_bmpx();
        }
#endif

        if (NEED(INFO_LOADAVG)) {
                update_load_average();
        }

        if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS) || NEED(INFO_TOP))
                        && current_update_time - last_meminfo_update > 6.9) {
                update_meminfo();
                if (no_buffers) {
                        info.mem -= info.bufmem;
                        info.memeasyfree += info.bufmem;
                }
                last_meminfo_update = current_update_time;
        }

#ifdef X11
        if (NEED(INFO_X11)) {
                update_x11info();
        }
#endif

        if (NEED(INFO_TOP)) {
                update_top();
        }

        /* update_fs_stat() won't do anything if there aren't fs -things */
        if (NEED(INFO_FS) && current_update_time - last_fs_update > 12.9) {
                update_fs_stats();
                last_fs_update = current_update_time;
        }
#ifdef TCP_PORT_MONITOR
        if (NEED(INFO_TCP_PORT_MONITOR)) {
               
update_tcp_port_monitor_collection(info.p_tcp_port_monitor_collection);
        }
#endif
        if (NEED(INFO_ENTROPY)) {
                update_entropy();
        }
#if defined(__linux__)
        if (NEED(INFO_USERS)) {
                update_users();
        }
        if (NEED(INFO_GW)) {
                update_gateway_info();
        }
#endif /* __linux__ */
        if (NEED(INFO_DNS)) {
                update_dns_data();
        }
}

int round_to_int(float f)
{
        if (f >= 0.0) {
                return (int) (f + 0.5);
        } else {
                return (int) (f - 0.5);
        }
}






cpuinfo 

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Pentium(R) Dual  CPU  E2180  @ 2.00GHz
stepping        : 13
cpu MHz         : 1999.968
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc
arch_perfmon pebs bts pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
bogomips        : 3999.93
clflush size    : 64
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Pentium(R) Dual  CPU  E2180  @ 2.00GHz
stepping        : 13
cpu MHz         : 1999.968
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc
arch_perfmon pebs bts pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
bogomips        : 3999.90
clflush size    : 64
power management:


-- 
           Summary: internal compiler error: Segmentation faul
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: a dot fiaschi at ao-pisa dot toscana dot it
  GCC host triplet: slackware-linux 12.2
GCC target triplet: i486-slackware-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38944


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/38944] internal compiler error: Segmentation faul
  2009-01-23 12:20 [Bug c/38944] New: internal compiler error: Segmentation faul a dot fiaschi at ao-pisa dot toscana dot it
@ 2009-01-23 17:02 ` ubizjak at gmail dot com
  2009-02-27  1:17 ` [Bug middle-end/38944] internal compiler error: Segmentation fault pinskia at gcc dot gnu dot org
  2009-02-27  1:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2009-01-23 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2009-01-23 17:02 -------
1) The source as inlined in bugreport is useless, please see [1] for a detailed
bug report instructions and _attach_ generated preprocessed source (unless it
is a couple of tens of lines long...).

2) -march=native automatically sets -march and -mtune, depending on the
processor the compiler is running on. Please paste full output, as generated
with -v.

3) Try to compile with gcc-4.3 or gcc-4.4. gcc-4.2 will be EOL-d in a couple of
weeks, and fixing 4.2 bugs is very low on developers priority lists.

[1] http://gcc.gnu.org/bugs.html#detailed


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38944


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/38944] internal compiler error: Segmentation fault
  2009-01-23 12:20 [Bug c/38944] New: internal compiler error: Segmentation faul a dot fiaschi at ao-pisa dot toscana dot it
  2009-01-23 17:02 ` [Bug c/38944] " ubizjak at gmail dot com
@ 2009-02-27  1:17 ` pinskia at gcc dot gnu dot org
  2009-02-27  1:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-27  1:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
          Component|c                           |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38944


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/38944] internal compiler error: Segmentation fault
  2009-01-23 12:20 [Bug c/38944] New: internal compiler error: Segmentation faul a dot fiaschi at ao-pisa dot toscana dot it
  2009-01-23 17:02 ` [Bug c/38944] " ubizjak at gmail dot com
  2009-02-27  1:17 ` [Bug middle-end/38944] internal compiler error: Segmentation fault pinskia at gcc dot gnu dot org
@ 2009-02-27  1:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-27  1:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38944


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/38944] internal compiler error: Segmentation fault
       [not found] <bug-38944-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-10 18:36 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-10 18:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38944

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-10 18:35:55 UTC ---
No feedback in almost 3 years so closing.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-10 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-23 12:20 [Bug c/38944] New: internal compiler error: Segmentation faul a dot fiaschi at ao-pisa dot toscana dot it
2009-01-23 17:02 ` [Bug c/38944] " ubizjak at gmail dot com
2009-02-27  1:17 ` [Bug middle-end/38944] internal compiler error: Segmentation fault pinskia at gcc dot gnu dot org
2009-02-27  1:17 ` pinskia at gcc dot gnu dot org
     [not found] <bug-38944-4@http.gcc.gnu.org/bugzilla/>
2012-01-10 18:36 ` pinskia at gcc dot gnu.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).