Merge from mainline (163495:164578).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.c-torture / compile / 20100915-1.c
blob04f6ab0fd70a7df0ad958d43734f7f1526c4a952
1 /* PR rtl-optimization/45593 */
2 /* Testcase by Arnaud Lacombe <lacombar@gmail.com> */
4 typedef unsigned int __u32;
5 typedef __u32 __be32;
6 static inline __attribute__((always_inline)) int __attribute__((__cold__)) printk(const char *s, ...) { return 0; }
7 typedef struct journal_s journal_t;
8 typedef struct journal_header_s
10 __be32 h_magic;
11 __be32 h_blocktype;
12 __be32 h_sequence;
13 } journal_header_t;
14 typedef struct journal_superblock_s
16 journal_header_t s_header;
17 __be32 s_blocksize;
18 __be32 s_maxlen;
19 } journal_superblock_t;
20 struct journal_s
22 struct buffer_head *j_sb_buffer;
23 journal_superblock_t *j_superblock;
24 int j_format_version;
25 int j_blocksize;
26 unsigned int j_maxlen;
28 static void journal_fail_superblock (journal_t *journal)
30 journal->j_sb_buffer = ((void *)0);
32 static int journal_get_superblock(journal_t *journal)
34 struct buffer_head *bh;
35 journal_superblock_t *sb;
36 int err = -100;
37 bh = journal->j_sb_buffer;
38 if (!buffer_uptodate(bh)) {
39 if (!buffer_uptodate(bh)) {
40 printk ("JBD: IO error reading journal superblock\n");
41 goto out;
44 err = -101;
45 if (sb->s_header.h_magic != (( __be32)(__u32)(0)) ||
46 sb->s_blocksize != (( __be32)(__u32)(journal->j_blocksize))) {
47 printk("JBD: no valid journal superblock found\n");
48 goto out;
50 switch((( __u32)(__be32)(sb->s_header.h_blocktype))) {
51 case 0:
52 case 1:
53 break;
54 default:
55 goto out;
57 if ((( __u32)(__be32)(sb->s_maxlen)) < journal->j_maxlen)
58 journal->j_maxlen = (( __u32)(__be32)(sb->s_maxlen));
59 else if ((( __u32)(__be32)(sb->s_maxlen)) > journal->j_maxlen) {
60 printk ("JBD: journal file too short\n");
61 goto out;
63 return 0;
64 out:
65 journal_fail_superblock(journal);
66 return err;
68 static int load_superblock(journal_t *journal)
70 journal_get_superblock(journal);
71 return 0;
73 int jbd2_journal_update_format (journal_t *journal)
75 journal_get_superblock(journal);
76 return 0;
78 int jbd2_journal_wipe(journal_t *journal, int write)
80 load_superblock(journal);
81 return 0;